diff --git a/CHANGELOG.md b/CHANGELOG.md index d205129..082fccd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.2.0] +* Add BartMenuRoute.bottomBarBuilder to build a single item bottom bar (so you can show notification badge on it) +* Add onRouteChanged callback to BartScaffold to get notified when route change + ## [1.1.0] * Material 3 bottom bar theme * Hide / show bottom bar from action diff --git a/README.md b/README.md index bb5af7c..31c41f0 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,39 @@ ThemeData( ``` +## 🗃  Bottom icon notfication badge + +You can add a notification badge on your bottom bar icon.
+ +To do that, you need to use the `BartMenuRoute.bottomBarBuilder` method instead of `BartMenuRoute.bottomBar` in your route definitions: + +```dart +BartMenuRoute.bottomBarBuilder( + label: "Library", + builder: (context) => BottomBarIcon.builder( + icon: const Icon(Icons.video_library_outlined), + notificationBuilder: (context) => Container( + decoration: const BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + padding: const EdgeInsets.all(4), + child: const Text( + "1", + style: TextStyle(color: Colors.white, fontSize: 10), + ), + ), + ), + path: '/library', + pageBuilder: (parentContext, tabContext, settings) => const FakeListPage( + key: PageStorageKey("library"), + ), + transitionDuration: bottomBarTransitionDuration, + transitionsBuilder: bottomBarTransition, +), +``` + + ## 🗃  State caching ### How it works 🤔 ? diff --git a/pubspec.yaml b/pubspec.yaml index 3dde905..df8a9f8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: bart description: A bottom navigation bar using navigator 2 for switching tabs -version: 1.1.0 +version: 1.2.0 homepage: https://en.apparence.io repository: https://github.com/Apparence-io/bart