import 'package:flutter/material.dart'; import 'package:konectar_events/utils/app_theme.dart'; import 'package:konectar_events/view/home.dart'; import 'package:konectar_events/widgets/drawerusercontroller.dart'; import 'package:konectar_events/widgets/home_drawer.dart'; class NavigationHomeScreen extends StatefulWidget { @override _NavigationHomeScreenState createState() => _NavigationHomeScreenState(); } class _NavigationHomeScreenState extends State { Widget? screenView; DrawerIndex? drawerIndex; @override void initState() { drawerIndex = DrawerIndex.HOME; screenView = const HomeScreen(); super.initState(); } @override Widget build(BuildContext context) { return Container( color: AppTheme.white, child: SafeArea( top: false, bottom: false, child: Scaffold( backgroundColor: AppTheme.nearlyWhite, body: DrawerUserController( screenIndex: drawerIndex, drawerWidth: MediaQuery.of(context).size.width * 0.75, onDrawerCall: (DrawerIndex drawerIndexdata) { changeIndex(drawerIndexdata); //callback from drawer for replace screen as user need with passing DrawerIndex(Enum index) }, screenView: screenView, //we replace screen view as we need on navigate starting screens like MyHomePage, HelpScreen, FeedbackScreen, etc... ), ), ), ); } void changeIndex(DrawerIndex drawerIndexdata) { if (drawerIndex != drawerIndexdata) { drawerIndex = drawerIndexdata; switch (drawerIndex) { case DrawerIndex.HOME: setState(() { screenView = const HomeScreen(); }); break; case DrawerIndex.Help: setState(() { screenView = HomeScreen(); }); break; case DrawerIndex.FeedBack: setState(() { screenView = HomeScreen(); }); break; case DrawerIndex.Invite: setState(() { screenView = HomeScreen(); }); break; default: break; } } } }