From 24643093ab681da5ad58f7abf1ab337cdb9c61df Mon Sep 17 00:00:00 2001 From: Gautier Date: Mon, 3 Apr 2023 14:09:30 +0200 Subject: [PATCH] updated readme --- README.md | 29 ++++++++++++++++++++++++++++- example/lib/navigation.dart | 2 +- lib/bart/bart_scaffold.dart | 4 ++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 693818a..be9dd09 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ Bart include 4 ways to display a bottom bar: BartBottomBar.cupertino() // iOS look. BartBottomBar.material3() // Android look. BartBottomBar.adaptive() // automatically select between cupertino & material depending on the device. -BartBottomBar.custom() // your how design +BartBottomBar.custom() // your own design ``` To custom the bottom bar, simply extends `BartBottomBarCustom` and create your own bottom bar like `SimpleBottomBar`(in example project).
@@ -210,6 +210,33 @@ Actions.invoke(context,AppBarAnimationIntent.show()); Actions.invoke(context,AppBarAnimationIntent.hide()); ``` +## 🫥  Show/hide bottom bar +Sometimes you wants to hide the bottom menu bar. +As this is possible for the appbar you can use a mixin for that. +It just require to be called from a sub context of the BartScaffold. + +```dart +Actions.invoke(context, BottomBarIntent.show()); +Actions.invoke(context, BottomBarIntent.hide()); +``` + +Or use the mixin +```dart +class MyPage extends StatelessWidget with BartNotifier { + const MyPage({ Key? key }) : super(key: key); + + @override + Widget build(BuildContext context) { + // directly show the bottom bar + showBottomBar(context); + // directly hide the bottom bar + hideBottomBar(context); + return Container(); + } +} +``` + + ## 💫  Transitions between items You can use the official [**animation plugin**](https://pub.dev/packages/animations) to create better transition or create your owns. diff --git a/example/lib/navigation.dart b/example/lib/navigation.dart index 47b4c71..898a61a 100644 --- a/example/lib/navigation.dart +++ b/example/lib/navigation.dart @@ -16,7 +16,7 @@ class _MainPageMenuState extends State { Widget build(BuildContext context) { return BartScaffold( routesBuilder: widget.routesBuilder, - showBottomBar: true, + showBottomBarOnStart: true, bottomBar: BartBottomBar.material(), // bottomBar: BartBottomBar.custom( // bottomBarFactory: SimpleBottomBar(), diff --git a/lib/bart/bart_scaffold.dart b/lib/bart/bart_scaffold.dart index c3478c3..7588b0f 100644 --- a/lib/bart/bart_scaffold.dart +++ b/lib/bart/bart_scaffold.dart @@ -24,10 +24,10 @@ class BartScaffold extends StatefulWidget { required this.routesBuilder, this.initialRoute, this.scaffoldOptions, - bool showBottomBar = true, + bool showBottomBarOnStart = true, }) : appBarNotifier = ValueNotifier(null), showAppBarNotifier = ValueNotifier(false), - showBottomBarNotifier = ValueNotifier(showBottomBar), + showBottomBarNotifier = ValueNotifier(showBottomBarOnStart), super(key: key); @override