diff --git a/flutter_mobx/CHANGELOG.md b/flutter_mobx/CHANGELOG.md index 32ec939f..ad419783 100644 --- a/flutter_mobx/CHANGELOG.md +++ b/flutter_mobx/CHANGELOG.md @@ -1,10 +1,13 @@ +## 2.2.0+1 + - renamed `Observer.withChild` to `Observer.withBuiltChild` +` ## 2.2.0 - - `Observer` is updated with the new `Observer.withChild` constructor, so you can exclude child branch from the re-rendering. - [@subzero911](https://github.com/subzero911) \ - In case if you use `Builder.withChild`, you should provide two parameters: `builderWithChild` and `child`: + - `Observer` is updated with the new `Observer.withBuiltChild` constructor, so you can exclude child branch from the re-rendering. - [@subzero911](https://github.com/subzero911) \ + In case if you use `Observer.withBuiltChild`, you should provide two parameters: `builderWithChild` and `child`: ```dart - Observer.withChild( - builderWithChild: (context, child) => FooWidget(foo: foo, child: child), - child: BarWidget(), // is not rebuilt + Observer.withBuiltChild( + builderWithChild: (context, child) => FooWidget(foo: foo, bar: child), + child: BarWidget(), // won't rebuild ), ``` diff --git a/flutter_mobx/lib/src/observer.dart b/flutter_mobx/lib/src/observer.dart index 770f3b73..bda3330f 100644 --- a/flutter_mobx/lib/src/observer.dart +++ b/flutter_mobx/lib/src/observer.dart @@ -33,9 +33,9 @@ class Observer extends StatelessObserverWidget { warnWhenNoObservables: warnWhenNoObservables, ); - /// Observer which excludes the child branch + /// Observer which excludes the child branch from being rebuilt // ignore: prefer_const_constructors_in_immutables - Observer.withChild({ + Observer.withBuiltChild({ Key? key, required this.builderWithChild, required this.child, @@ -50,8 +50,10 @@ class Observer extends StatelessObserverWidget { warnWhenNoObservables: warnWhenNoObservables, ); + /// regular builder, suitable for most cases final WidgetBuilder? builder; + /// builder function with child parameter final TransitionBuilder? builderWithChild; /// The child widget to pass to the [builderWithChild]. diff --git a/flutter_mobx/lib/version.dart b/flutter_mobx/lib/version.dart index 855f13a8..be0896c7 100644 --- a/flutter_mobx/lib/version.dart +++ b/flutter_mobx/lib/version.dart @@ -1,4 +1,4 @@ // Generated via set_version.dart. !!!DO NOT MODIFY BY HAND!!! /// The current version as per `pubspec.yaml`. -const version = '2.2.0'; +const version = '2.2.0+1'; diff --git a/flutter_mobx/pubspec.yaml b/flutter_mobx/pubspec.yaml index 288d7d81..5325ef93 100644 --- a/flutter_mobx/pubspec.yaml +++ b/flutter_mobx/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_mobx description: Flutter integration for MobX. It provides a set of Observer widgets that automatically rebuild when the tracked observables change. -version: 2.2.0 +version: 2.2.0+1 homepage: https://github.com/mobxjs/mobx.dart issue_tracker: https://github.com/mobxjs/mobx.dart/issues diff --git a/flutter_mobx/test/flutter_mobx_test.dart b/flutter_mobx/test/flutter_mobx_test.dart index e8c8a663..89b7b959 100644 --- a/flutter_mobx/test/flutter_mobx_test.dart +++ b/flutter_mobx/test/flutter_mobx_test.dart @@ -59,7 +59,7 @@ void main() { expect(renderCount, equals(1)); }); - testWidgets("Observer.withChild's child doesn't re-render", (tester) async { + testWidgets("Observer.withBuiltChild's child doesn't re-render", (tester) async { final message = Observable('Click'); final key1 = UniqueKey(); final key2 = UniqueKey(); @@ -67,7 +67,7 @@ void main() { await tester.pumpWidget( MaterialApp( - home: Observer.withChild( + home: Observer.withBuiltChild( builderWithChild: (context, child) { return Column( children: [