Advertisement
abhi_diablo

Bottomnav

Oct 10th, 2020
2,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.53 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3.  
  4. void main() => runApp(MyApp());
  5.  
  6. class MyApp extends StatefulWidget {
  7.   @override
  8.   State<StatefulWidget> createState() {
  9.     return MyAppState();
  10.   }
  11. }
  12.  
  13. class MyAppState extends State<MyApp> {
  14.   int _selectedPage = 2;
  15.  
  16.   final _pageOptions = [
  17.    Container(),
  18.     Container(),
  19.     Container(),
  20.     Container(),
  21.      Container(),
  22.   ];
  23.  
  24.   @override
  25.   Widget build(BuildContext context) {
  26.     return MaterialApp(
  27.       debugShowCheckedModeBanner: false,
  28.       title: 'Sync Shop',
  29.       theme: ThemeData(
  30.         primarySwatch: Colors.red,
  31.       ),
  32.       home: Scaffold(
  33.         body: _pageOptions[_selectedPage],
  34.         bottomNavigationBar: BottomNavigationBar(
  35.           type: BottomNavigationBarType.fixed,
  36.           currentIndex: _selectedPage,
  37.           onTap: (int index) {
  38.             setState(() {
  39.               _selectedPage = index;
  40.             });
  41.           },
  42.           items: [
  43.          
  44.             BottomNavigationBarItem(
  45.               icon: Icon(Icons.note),
  46.               label: "Notification",
  47.             ),
  48.             BottomNavigationBarItem(
  49.               icon: Icon(Icons.work),
  50.               label: "Appointment",
  51.             ),
  52.             BottomNavigationBarItem(
  53.               icon: Icon(Icons.waterfall_chart),
  54.               label: "Request",
  55.             ),
  56.             BottomNavigationBarItem(
  57.               icon: Icon(Icons.account_circle),
  58.               label: "Profile",
  59.             ),
  60.           ],
  61.         ),
  62.       ),
  63.     );
  64.   }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement