Skip to content

Commit

Permalink
show/hide bottom bar bugfix with stack
Browse files Browse the repository at this point in the history
  • Loading branch information
g-apparence committed Apr 2, 2023
1 parent 0d86da5 commit bb5890a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 36 deletions.
22 changes: 2 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,10 @@
"version": "0.2.0",
"configurations": [
{
"name": "bart",
"request": "launch",
"type": "dart"
},
{
"name": "bart (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "example",
"cwd": "example",
"request": "launch",
"type": "dart"
},
{
"name": "example (profile mode)",
"cwd": "example",
"name": "bart example",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
"program": "example/lib/main.dart",
}
]
}
8 changes: 5 additions & 3 deletions example/lib/navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ class _MainPageMenuState extends State<MainPageMenu> {
Widget build(BuildContext context) {
return BartScaffold(
routesBuilder: widget.routesBuilder,
bottomBar: BartBottomBar.custom(
bottomBarFactory: SimpleBottomBar(),
),
showBottomBar: true,
bottomBar: BartBottomBar.material(),
// bottomBar: BartBottomBar.custom(
// bottomBarFactory: SimpleBottomBar(),
// ),
);
}
}
3 changes: 2 additions & 1 deletion example/lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ List<BartMenuRoute> subRoutes() {
),
transitionDuration: bottomBarTransitionDuration,
transitionsBuilder: bottomBarTransition,
cache: false,
),
BartMenuRoute.bottomBar(
label: "Library",
Expand Down Expand Up @@ -78,4 +79,4 @@ Widget bottomBarTransition(
child: child,
);

const bottomBarTransitionDuration = Duration(milliseconds: 700);
const bottomBarTransitionDuration = Duration(milliseconds: 300);
1 change: 1 addition & 0 deletions example/lib/tabs/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class HomePage extends StatelessWidget with AppBarNotifier, BartNotifier {
TextButton(
child: const Text(
"Add AppBar",
style: TextStyle(color: Colors.black),
),
onPressed: () {
updateAppBar(
Expand Down
19 changes: 7 additions & 12 deletions lib/bart/bart_bottombar_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@ class AnimatedBottomBar extends StatelessWidget {
Widget build(BuildContext context) {
return ValueListenableBuilder<bool>(
valueListenable: showStateNotifier,
builder: (context, show, child) => Stack(
children: [
AnimatedPositioned(
curve: Curves.decelerate,
duration: const Duration(milliseconds: 300),
bottom: show ? 0 : 150,
left: 0,
right: 0,
child: bottomBar,
),
],
),
child: bottomBar,
builder: (context, show, child) {
if (!show) {
return const SizedBox(height: 0, width: 0);
}
return child!;
},
);
}
}
Expand Down

0 comments on commit bb5890a

Please sign in to comment.