I am implementing curved navigation bar in my flutter project. But I can't recognise why the data is not passing to the second page(i.e. notification.dart page). The same data is showing in the first page(i.e. home.dart page) but not in the second page(i.e. notification.dart page)
Here is my code:
Appbar's code:
Widget aapBarSection(String title, Color color, BuildContext context){
return AppBar(
title: Text(title, style:TextStyle(fontFamily: 'Poppins-Regular'), ),
centerTitle: true,
backgroundColor: color,
actions: [
FlatButton(
child: Text('Logout', style: TextStyle(color: Colors.white)),
onPressed: () async{
SharedPreferences preferences = await SharedPreferences.getInstance();
preferences.setBool("isLogin", false);
Navigator.of(context).pushNamed('/login');
},
)
],
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: (){
exit(0);
},
),
);
}
NavigationBar's code:
int currentIndex = 0;
Widget navBarSection(Color color, Color btnColor){
return CurvedNavigationBar(
index: 0,
items:
[
Icon(Icons.home, color: Colors.white),
Icon(Icons.notifications, color: Colors.white),
Icon(Icons.menu, color: Colors.white),
Icon(Icons.history, color: Colors.white),
Icon(Icons.person, color: Colors.white),
],
color: color,
buttonBackgroundColor: btnColor,
animationCurve: Curves.easeInOut,
animationDuration: Duration(milliseconds: 600),
onTap: (index){
setState(() {
currentIndex = index;
});
},
);
}
void setState(Null Function() param0) {
}
home.dart code:
import 'package:thehelpdesk/widgets/appbar.dart';
import 'package:thehelpdesk/widgets/navigation_bar.dart';
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: aapBarSection('Home',Colors.blueAccent[700],context),
bottomNavigationBar: navBarSection(
Colors.blueAccent[700],
Colors.blueAccent[700],
),
body: Container(
color: Colors.grey,
child: Text('abcd', style: TextStyle(
fontSize: 50,
color: Colors.black
),),
),
);
}
}
notification.dart code:
import 'package:thehelpdesk/widgets/appbar.dart';
import 'package:thehelpdesk/widgets/navigation_bar.dart';
class NotificationPage extends StatefulWidget {
@override
_NotificationPageState createState() => _NotificationPageState();
}
class _NotificationPageState extends State<NotificationPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: aapBarSection('Notification',Colors.blueAccent[700],context),
bottomNavigationBar: navBarSection(
Colors.blueAccent[700],
Colors.blueAccent[700],
),
body: Container(
color: Colors.grey,
child: Text('abcd', style: TextStyle(
fontSize: 50,
color: Colors.black
),),
),
);
}
}