From 09989c45c34df6b701f2bbb1b14826b9f1da009b Mon Sep 17 00:00:00 2001 From: Adrien Bonnin <adbonnin@ippon.fr> Date: Mon, 19 Sep 2022 16:14:49 +0200 Subject: [PATCH] :recycle: Refactoring du nom des fichiers de sources pour l'article 02 --- docs/02_integration_avec_flutter.md | 8 ++++---- .../{consumer_example.dart => 01_consumer_example.dart} | 0 .../{stateless_example.dart => 02_stateless_example.dart} | 0 .../{stateful_example.dart => 03_stateful_example.dart} | 0 .../{parent_example.dart => 04_parent_example.dart} | 0 lib/main.dart | 8 ++++---- 6 files changed, 8 insertions(+), 8 deletions(-) rename lib/article_02/{consumer_example.dart => 01_consumer_example.dart} (100%) rename lib/article_02/{stateless_example.dart => 02_stateless_example.dart} (100%) rename lib/article_02/{stateful_example.dart => 03_stateful_example.dart} (100%) rename lib/article_02/{parent_example.dart => 04_parent_example.dart} (100%) diff --git a/docs/02_integration_avec_flutter.md b/docs/02_integration_avec_flutter.md index 969ad8f..fbe99eb 100644 --- a/docs/02_integration_avec_flutter.md +++ b/docs/02_integration_avec_flutter.md @@ -10,7 +10,7 @@ Dans Flutter, tout est widget. En suivant ce principe, Riverpod s'adapte à Flutter avec le widget `ProviderScope` dont la responsabilité est de partager les états qu'il contient à ses widgets enfants. Plusieurs manières permettent d'accéder à ces états, le widget `Consumer` étant la solution la moins intrusive : -[_source : consumer_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/consumer_example.dart) +[_source : 01_consumer_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/01_consumer_example.dart) ```dart final helloProvider = Provider<String>((ref) => 'Hello world'); // <1> @@ -67,7 +67,7 @@ Pour des cas plus complexes, Riverpod dispose de widgets spécifiques. L'autre solution proposée par `Riverpod` pour accéder au `WidgetRef` est de remplacer à la déclaration la classe étendue. La classe `ConsumerWidget` vient remplacer `StatelessWidget` pour les widgets sans états : -[_source : stateless_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/stateless_example.dart) +[_source : 02_stateless_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/02_stateless_example.dart) ```dart final countServiceProvider = StateNotifierProvider<CountService, int>((ref) => CountService(42)); // <1> @@ -134,7 +134,7 @@ Comme pour le `BuildContext`, ce `WidgetRef` est à passer aux méthodes qui ont Le `ConsumerWidget` venant remplacer le `StatelessWidget`, c'est tout naturellement que le `StatefulWidget` dispose de sa propre implémentation : -[_source : stateful_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/stateful_example.dart) +[_source : 03_stateful_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/03_stateful_example.dart) ```dart final countServiceProvider = StateNotifierProvider<CountService, int>((ref) => CountService(42)); // <1> @@ -219,7 +219,7 @@ C'est par exemple le cas pour récupérer ponctuellement un état `<7>` ou appel Le widget `ProviderScope` est un conteneur qui peut avoir en descendance un autre `ProviderScope` pour former un lien de parenté : -[_source : parent_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/parent_example.dart) +[_source : 04_parent_example.dart_](https://gitlab.ippon.fr/adbonnin/article_flutter_riverpod/-/blob/main/lib/article_02/04_parent_example.dart) ```dart final countServiceProvider = StateNotifierProvider<CountService, int>((ref) => CountService(42)); // <1> diff --git a/lib/article_02/consumer_example.dart b/lib/article_02/01_consumer_example.dart similarity index 100% rename from lib/article_02/consumer_example.dart rename to lib/article_02/01_consumer_example.dart diff --git a/lib/article_02/stateless_example.dart b/lib/article_02/02_stateless_example.dart similarity index 100% rename from lib/article_02/stateless_example.dart rename to lib/article_02/02_stateless_example.dart diff --git a/lib/article_02/stateful_example.dart b/lib/article_02/03_stateful_example.dart similarity index 100% rename from lib/article_02/stateful_example.dart rename to lib/article_02/03_stateful_example.dart diff --git a/lib/article_02/parent_example.dart b/lib/article_02/04_parent_example.dart similarity index 100% rename from lib/article_02/parent_example.dart rename to lib/article_02/04_parent_example.dart diff --git a/lib/main.dart b/lib/main.dart index 438938f..fff6b4e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,8 @@ import 'package:article_flutter_riverpod/app.dart'; -import 'package:article_flutter_riverpod/article_02/consumer_example.dart'; -import 'package:article_flutter_riverpod/article_02/parent_example.dart'; -import 'package:article_flutter_riverpod/article_02/stateful_example.dart'; -import 'package:article_flutter_riverpod/article_02/stateless_example.dart'; +import 'package:article_flutter_riverpod/article_02/01_consumer_example.dart'; +import 'package:article_flutter_riverpod/article_02/04_parent_example.dart'; +import 'package:article_flutter_riverpod/article_02/03_stateful_example.dart'; +import 'package:article_flutter_riverpod/article_02/02_stateless_example.dart'; import 'package:article_flutter_riverpod/example.dart'; import 'package:article_flutter_riverpod/presentation/01_introduction_example.dart' as introduction_example; import 'package:article_flutter_riverpod/presentation/02_provider_example.dart' as provider_example; -- GitLab