Closed Amr1440 closed 2 years ago
Navigation bar should put/move into different Stateful Widget, (builder,id)=>Widget only update/change when drawer's menu item click.
Navigation bar should put/move into different Stateful Widget, (builder,id)=>Widget only update/change when drawer's menu item click.
Yes, but there is no way to update the view with an index outside of the builder. The builder only rebuilds on tap presses like you said for the drawer.
If I want to use navigation bottom bar from Material, Cupertino or a custom one, I can update the index of the view to show, but the builder is the only place the view content can be updated, which is impossible due to no re-rendering outside a drawer tap.
I would suggest adding a child property so we can extend this functionality without breaking the current architecture of the library.
This then means we can use the CupertinoTabBar and CupertinoTabScaffold and custom tab bars.
Edit:
My Bottom bar and drawer navigations have different content and the navigation items/indexes are not related.
I added body
on DrawerScaffold, may try version 2.2.2
or 2.3.0-dev.6
,
Feel free to open this issue again, if the problem persist
Cant switch tabs when clicking on bottom navigation bar items.
@override Widget build(BuildContext context) { return Sizer(builder: (context, orientation, deviceType) { return WillPopScope( onWillPop: () async => false, child: Directionality( textDirection: TextDirection.rtl, child: DrawerScaffold( extendedBody: true, controller: drawerController, extendBodyBehindAppBar: true, appBar: AppHeader( drawerController: drawerController, ), drawers: [ SideDrawer( padding: EdgeInsets.fromLTRB(24, 16, 24, 16), menu: menu, direction: Direction.right, animation: true, selectorColor: Colors.white, background: DecorationImage( fit: BoxFit.fill, image: AssetImage('assets/images/generalBackground.png')), color: Color(0x00000000), selectedItemId: selectedMenuItemId, onMenuItemSelected: (itemId) { setState(() { selectedMenuItemId = itemId; }); }, ), ], builder: (context, id) { return SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: Container( width: double.infinity, decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/generalBackground.png'), fit: BoxFit.cover, ), ), alignment: Alignment.center, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox( height: 12.h, ), Row( children: [ SizedBox( width: 3, ), Icon( Icons.my_location, color: Colors.white54, size: 20.0, ), SizedBox( width: 3, ), Text( 'داخل النطاق', style: TextStyle( color: Colors.white, fontFamily: demiFont), ), Spacer(), Directionality( textDirection: TextDirection.ltr, child: Text( date, style: TextStyle( fontFamily: demiFontEnglish, color: Colors.white), ), ), Spacer(), Icon( dayTime ? Icons.wb_sunny : Icons.nightlight_round, color: dayTime ? Colors.yellow : Colors.white), SizedBox( width: 3, ), Text( time, style: TextStyle( fontFamily: demiFontEnglish, color: Colors.white), ), SizedBox( width: 3, ) ], ), SizedBox(height: 10), tabScreens[navigationBarIndex] ], ), ), ); }, bottomNavigationBar: FFNavigationBar( theme: FFNavigationBarTheme( selectedItemLabelColor: taqahDefualtTextColor, selectedItemIconColor: Colors.white, selectedItemBackgroundColor: taqahGreen, unselectedItemIconColor: taqahBlue, showSelectedItemShadow: false), selectedIndex: navigationBarIndex, onSelectTab: (index) { setState(() { navigationBarIndex = index; }); }, items: [ FFNavigationBarItem( iconData: Icons.home_filled, label: "الرئيسية", ), FFNavigationBarItem(iconData: Icons.bookmark, label: "المفضلة"), FFNavigationBarItem( iconData: Icons.notifications, label: "التنبيهات", ), FFNavigationBarItem( iconData: Icons.help, label: "الدعم", ), ], ), ), ), ); }); }