78 lines
2.2 KiB
Dart
78 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:konectar_events/contacts_module/ui_screen/new_contacts.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<NavigationHomeScreen> {
|
|
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 = Contacts1();
|
|
});
|
|
break;
|
|
case DrawerIndex.FeedBack:
|
|
setState(() {
|
|
screenView = HomeScreen();
|
|
});
|
|
break;
|
|
case DrawerIndex.Invite:
|
|
setState(() {
|
|
screenView = HomeScreen();
|
|
});
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|