import 'package:flutter/material.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData(primarySwatch: Colors.blue), home: MyHomePage(), ); } } class MyHomePage extends StatefulWidget { @override State createState() { return _HomePage(); } } class _HomePage extends State { var selectedIndex = 0; var currentPage = DrawerSection.home; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Welcome')), body: selectedIndex == 0 ? DefaultTabController( length: 3, child: Scaffold( appBar: AppBar( title: Text('TabBar Screen'), bottom: TabBar( tabs: [ Tab(icon: Icon(Icons.home), text: 'Home'), Tab(icon: Icon(Icons.bookmark), text: 'Bookmark'), Tab(icon: Icon(Icons.call), text: 'Call'), ], ), ), body: TabBarView( children: [ Center(child: Text('Home')), Center(child: Text('Bookmark')), Center(child: Text('Call')), ], ), ), ) : Center(child: Text('Selected Page: ${currentPage.name}')), bottomNavigationBar: BottomNavigationBar( items: const [ BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), BottomNavigationBarItem( icon: Icon(Icons.settings), label: 'Settings', ), ], currentIndex: selectedIndex, onTap: (index) { setState(() { selectedIndex = index; }); }, ), drawer: Drawer( child: SingleChildScrollView( child: Column( children: [ Container( margin: EdgeInsets.all(4), child: Center( child: Column( children: [ Image.network( 'https://image.shutterstock.com/image-photo/stock-photo-headshot-portrait-close-up-smiling-confident-businessman-wearing-glasses-looking-at-camera-250nw-1714666150.jpg', ), Text('User Name'), Text('user@gmail.com'), ], ), ), ), DrawerMenuList(currentPage: currentPage), ], ), ), ), ); } } class DrawerMenuList extends StatelessWidget { final DrawerSection currentPage; DrawerMenuList({required this.currentPage}); @override Widget build(BuildContext context) { return Column( children: [ menuItem(1, "Home", Icons.home, currentPage == DrawerSection.home), menuItem( 2, "Contacts", Icons.contact_page, currentPage == DrawerSection.contacts, ), menuItem( 3, "Notifications", Icons.notifications, currentPage == DrawerSection.notifications, ), menuItem( 4, "Settings", Icons.settings, currentPage == DrawerSection.settings, ), ], ); } Widget menuItem(int id, String title, IconData icon, bool selected) { return Material( color: selected ? Colors.grey[300] : Colors.transparent, child: InkWell( onTap: () { Navigator.pop(context); // Update the selected index or handle navigation logic }, child: Row(children: [Icon(icon, color: Colors.black), Text(title)]), ), ); } } enum DrawerSection { home, contacts, notifications, settings }