i am trying to use CurveBottomNavigatorBar in my flutter project...
i used my Curve... in the main dart like this:
class _BottomNavigatorBarState extends State<BottomNavigatorBar> {
int selectedIndex = 0;
final screen = [
HomeScreen(),
CartScreen(),
MyStore(),
SettingScreen(),
];
@override
Widget build(BuildContext context) {
int args = ModalRoute.of(context).settings.arguments;
return Scaffold(
body: screen[selectedIndex],
bottomNavigationBar: CurvedNavigationBar(
height: 55,
backgroundColor: Colors.transparent,
buttonBackgroundColor: Theme.of(context).accentColor,
color: Theme.of(context).primaryColor,
animationCurve: Curves.easeOutCubic,
index: selectedIndex,
items: <Widget>[
// code here
],
onTap: (index) {
setState(() {
args = selectedIndex;
selectedIndex = index;
});
},
),
);
}
}
when i go to my store screen there is an add button that take me to a Form to complete it but when i go back it doesn't show me the BOTNAVBAR on my screen so i though that if i can pass arguments so when i pushback to my main it open my my stores automatically
this is the adding store page:
@override
Widget build(BuildContext context) {
int index = 2;
_onBackPressed() {
Navigator.of(context).pushReplacementNamed(
'/myStore',
arguments: index,
);
}
return WillPopScope(
onWillPop: () {
return _onBackPressed();
},
child: Scaffold(
appBar: AppBar(
title: Text('Add Store'),
leading: IconButton(
onPressed: () {
Navigator.of(context).pushReplacementNamed(
'/myStore',
arguments: index,
);
},
icon: Icon(Icons.arrow_back),
),
),
sp i did it like that and i know its wrong cause its not working
anyhelp please and excuse my bad english :(