From e27250276ffbf5fde430847b750c3bed29e291d4 Mon Sep 17 00:00:00 2001 From: markvideon Date: Tue, 31 Jan 2023 19:51:07 +1030 Subject: [PATCH] Version up --- CHANGELOG.md | 6 +++++- example/lib/main.dart | 28 ++++++++++++++++++---------- lib/src/component_ref.dart | 8 ++++++-- lib/src/has_component_ref_mixin.dart | 19 ++++++++++++++----- pubspec.yaml | 2 +- 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 289877b..847464b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 4.0.0+2 + +* Miscellaneous format post-processing on the files. + ## 4.0.0+1 * Miscellaneous tidy-up of package internals. @@ -5,7 +9,7 @@ ## 4.0.0 * Made [WidgetRef] property on [ComponentRef] private. It should not be accessed directly. -* Removed the [riverpodAwareGameProvider]. If required, this is better handled at the application-level. +* Removed the [riverpodAwar`eGameProvider]. If required, this is better handled at the application-level. ## 3.0.0 diff --git a/example/lib/main.dart b/example/lib/main.dart index 922dda8..1733d38 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -36,12 +36,17 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', - home: Row(crossAxisAlignment: CrossAxisAlignment.start, children: const [ - Expanded(child: FlutterCountingComponent()), - Expanded( + home: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: const [ + Expanded(child: FlutterCountingComponent()), + Expanded( child: RiverpodGameWidget.initialiseWithGame( - uninitialisedGame: RefExampleGame.new,),) - ],), + uninitialisedGame: RefExampleGame.new, + ), + ) + ], + ), ); } } @@ -61,9 +66,10 @@ class FlutterCountingComponent extends ConsumerWidget { children: [ Text('Flutter', style: textStyle), stream.when( - data: (value) => Text('$value', style: textStyle), - error: (error, stackTrace) => Text('$error', style: textStyle), - loading: () => Text('Loading...', style: textStyle),) + data: (value) => Text('$value', style: textStyle), + error: (error, stackTrace) => Text('$error', style: textStyle), + loading: () => Text('Loading...', style: textStyle), + ) ], ), ); @@ -88,8 +94,10 @@ class RefExampleGame extends FlameGame with HasComponentRef { class RiverpodGameWidget extends ConsumerStatefulWidget { const RiverpodGameWidget.readFromProvider({super.key}) : uninitialisedGame = null; - const RiverpodGameWidget.initialiseWithGame( - {super.key, required this.uninitialisedGame,}); + const RiverpodGameWidget.initialiseWithGame({ + super.key, + required this.uninitialisedGame, + }); final FlameGame Function(WidgetRef ref)? uninitialisedGame; diff --git a/lib/src/component_ref.dart b/lib/src/component_ref.dart index 0c148b5..ddd551d 100644 --- a/lib/src/component_ref.dart +++ b/lib/src/component_ref.dart @@ -21,8 +21,12 @@ class ComponentRef { void Function(Object error, StackTrace stackTrace)? onError, bool fireImmediately = true, }) { - return _widgetRef.listenManual(provider, onChange, - onError: onError, fireImmediately: fireImmediately,); + return _widgetRef.listenManual( + provider, + onChange, + onError: onError, + fireImmediately: fireImmediately, + ); } T read(ProviderListenable provider) { diff --git a/lib/src/has_component_ref_mixin.dart b/lib/src/has_component_ref_mixin.dart index 70a6255..87012d4 100644 --- a/lib/src/has_component_ref_mixin.dart +++ b/lib/src/has_component_ref_mixin.dart @@ -15,11 +15,20 @@ mixin HasComponentRef on Component { await super.onLoad(); } - void listen(ProviderListenable provider, void Function(T?, T) onChange, - {void Function(Object error, StackTrace stackTrace)? onError,}) { - _subscriptions.add(ref.listenManual(provider, (p0, p1) { - onChange(p0, p1); - }, onError: onError,),); + void listen( + ProviderListenable provider, + void Function(T?, T) onChange, { + void Function(Object error, StackTrace stackTrace)? onError, + }) { + _subscriptions.add( + ref.listenManual( + provider, + (p0, p1) { + onChange(p0, p1); + }, + onError: onError, + ), + ); } @override diff --git a/pubspec.yaml b/pubspec.yaml index 29c406d..7060381 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flame_riverpod description: Model classes and an example project for using Riverpod in conjunction with Flame. -version: 4.0.0+1 +version: 4.0.0+2 homepage: https://markvideon.dev environment: