Skip to content

Commit

Permalink
fix programmatically change index
Browse files Browse the repository at this point in the history
  • Loading branch information
maheshj01 committed Aug 18, 2024
1 parent 1c9c6c9 commit 68c2a0e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,19 @@ class _HomePageState extends ConsumerState<HomePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(
width: 100,
width: 60,
),
FloatingActionButton.extended(
heroTag: 'RandomIndex',
onPressed: () {
int index = Random().nextInt(100);
print('index: $index');
NavbarNotifier.index = index % 4;
},
label: const Text("Random Index"),
),
const SizedBox(
width: 20,
),
FloatingActionButton.extended(
heroTag: 'showSnackBar',
Expand Down Expand Up @@ -365,9 +377,7 @@ class _HomeFeedsState extends State<HomeFeeds> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Feeds'),
),
appBar: AppBar(title: const Text('Feeds')),
body: ListView.builder(
controller: _scrollController,
itemCount: 30,
Expand Down
1 change: 1 addition & 0 deletions lib/src/navbar_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ class _NavbarRouterState extends State<NavbarRouter>
child: AnimatedBuilder(
animation: _navbarNotifier,
builder: (context, child) {
_handleFadeAnimation();
return Stack(
children: [
AnimatedPadding(
Expand Down

0 comments on commit 68c2a0e

Please sign in to comment.