I’m utilizing persistant navigation bar in flutter however it’s showing on some pages & not showing on the identical pages.
really i used to be dealing with a difficulty that when from different buttons i need to change the energetic tab. so i merged the drawer into the house web page the place I had persistant bar code. however i’ve mounted that challenge
however the brand new challenge occurred. i had a challenge that the right way to change the appbar title i mounted that too utilizing getx. I’m altering the appbar title in init state of that web page.
however then after that the navigation bar began disappearing I do not perceive the right way to repair that challenge and why is that this being occurred…
PERSISTANT NAVBAR CODE
//relaxation code
Checklist<Widget> _buildScreens() {
return [
const DashboardScreen(),
const Order(),
const SetMpin(),
const Recharge(),
const Support(),
];
}
@override
Widget construct(BuildContext context) {
remaining NavigationController navigationController =
Get.put(NavigationController());
remaining cart = Supplier.of<CartProvider>(context);
return Scaffold(
appBar: AppBar(
title: Obx(() => Textual content(navigationController.identify.worth)),
// i amm right here setting the app bar title dynamically
actions: [
Row(
children: [
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const CartList()));
},
child: Center(
child: badges.Badge(
badgeContent: Consumer<CartProvider>(
builder: ((context, value, child) {
return Text(
cart.getCounter().toString(),
style: const TextStyle(color: Colors.white),
);
}),
),
child: const Icon(Icons.shopping_cart),
),
),
),
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Profile()));
},
icon: const Icon(Icons.person)),
],
),
]),
drawer: Drawer(
baby: ListView(
padding: EdgeInsets.zero,
kids: <Widget>[
ListTile(
title: const Text('Home'),
onTap: () {
setState(() {
controller.index = 0;
// WidgetsBinding.instance.addPostFrameCallback((_) {
// final navigationController =
// Get.find<NavigationController>();
// navigationController.setName("Profile Details");
// });
Navigator.pop(context);
});
},
),
ListTile(
title: const Text('Order'),
onTap: () {
setState(() {
controller.index = 1; // Change the index to the desired tab
Navigator.pop(context); // Close the drawer
});
},
),
ListTile(
title: const Text('Wallet'),
onTap: () {
setState(() {
controller.index = 2; // Change the index to the desired tab
Navigator.pop(context); // Close the drawer
});
},
),
ListTile(
title: const Text('Recharge'),
onTap: () {
setState(() {
controller.index = 3; // Change the index to the desired tab
Navigator.pop(context); // Close the drawer
});
},
),
ListTile(
title: const Text('Support'),
onTap: () {
setState(() {
controller.index = 4; // Change the index to the desired tab
Navigator.pop(context); // Close the drawer
});
},
),
],
),
),
physique: PersistentTabView(
context,
controller: controller,
screens: _buildScreens(),
gadgets: _navBarsItems(),
confineInSafeArea: true,
backgroundColor: Colours.white,
handleAndroidBackButtonPress: true,
resizeToAvoidBottomInset: true,
stateManagement: true,
hideNavigationBarWhenKeyboardShows: true,
ornament: NavBarDecoration(
borderRadius: BorderRadius.round(10.0),
colorBehindNavBar: Colours.white,
),
popAllScreensOnTapOfSelectedTab: true,
popActionScreens: PopActionScreensType.all,
navBarStyle: NavBarStyle.style1,
onItemSelected: (index) {
swap (index) {
case 0:
navigationController.setName("Dashboard");
break;
case 1:
navigationController.setName("Orders Checklist");
break;
case 2:
navigationController.setName("Pockets");
break;
case 3:
navigationController.setName("Recharges");
break;
case 4:
navigationController.setName("Assist");
break;
default:
navigationController.setName("M-Mart");
}
},
));
}
}
// relaxation code
SOME PAGE CODE
class _MyShopsListState extends State<MyShopsList> {
Checklist<Map> venderList = [];
bool loading = true;
@override
void initState() {
tremendous.initState();
WidgetsBinding.occasion.addPostFrameCallback((_) {
remaining navigationController = Get.discover<NavigationController>();
navigationController.setName("Store Lists");
});
CategoryServices.getVenderDetails(widget.serviceId.toInt())
.then((response) {
if (response['venderlist'] != null) {
for (var i = 0; i < response['venderlist'].size; i++) {
venderList.add(response['venderlist'][i]);
}
}
loading = false;
// setState(() {});
});
}
GETX CODE
class NavigationController extends GetxController {
RxString identify = "M-Mart".obs;
void setName(String newName) {
identify.worth = newName;
}
}