I have a MainPage with bottomnavigation bar with bottomnavigation items. I want to call APIs of bottomnavigation item pages whenever i tap on it i.e I want to reload page everytime I vist the page.
But in my case its not reloading everytime but at once when mainpage called all api of bottomnavigation items page APIs are called attime.
MainPage
class MainPage extends StatefulWidget{
#override
_MainPageState createState() => new _MainPageState();
}
class _MainPageState extends State<MainPage>{
ListQueue<int> _navigationQueue = ListQueue();
int _selectedIndex = 0;
int counter = Constant.CART_COUNT;
List<GlobalKey<NavigatorState>> _navigatorKeys = [
GlobalKey<NavigatorState>(),
GlobalKey<NavigatorState>(),
GlobalKey<NavigatorState>(),
GlobalKey<NavigatorState>()
];
Future<void> secureScreen() async {
await FlutterWindowManager.addFlags(FlutterWindowManager.FLAG_SECURE);
}
#override
void initState() {
// TODO: implement initState
super.initState();
secureScreen();
}
#override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (_navigationQueue.isEmpty) return true;
setState(() {
_navigationQueue.removeLast();
int position = _navigationQueue.isEmpty ? 0 : _navigationQueue.last;
_selectedIndex = position;
});
return false;
},
child: Scaffold(
backgroundColor: Colors.white,
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: _selectedIndex,
selectedItemColor: Colors.blueAccent,
showSelectedLabels: true,
showUnselectedLabels: false,
items: [
BottomNavigationBarItem(
icon: Icon(
FontAwesome.home,
color: Colors.grey,
),
label: 'Home',
activeIcon: Icon(
FontAwesome.home,
color: Colors.blueAccent,
),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesome.product_hunt,
color: Colors.grey,
),
label: 'Products',
activeIcon: Icon(
FontAwesome.product_hunt,
color: Colors.blueAccent,
),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesome.users,
color: Colors.grey,
),
label: 'Customers',
activeIcon: Icon(
FontAwesome.users,
color: Colors.blueAccent,
),
),
BottomNavigationBarItem(
icon: Icon(
FontAwesome.search_plus,
color: Colors.grey,
),
label: 'Order Details',
activeIcon: Icon(
FontAwesome.users,
color: Colors.blueAccent,
),
),
],
onTap: (index) {
if(_selectedIndex == _selectedIndex){
_navigationQueue.removeWhere((element) => element == index);
_navigationQueue.addLast(index);
setState(() {
this._selectedIndex = index;
});
}
},
),
body: Stack(
children: [
_buildOffstageNavigator(0),
_buildOffstageNavigator(1),
_buildOffstageNavigator(2),
_buildOffstageNavigator(3)
],
),
),
);
}
Map<String, WidgetBuilder> _routeBuilders(BuildContext context, int index) {
return {
'/': (context) {
return [
HomePage(),
ProductSearchPage(),
CustomerPage(),
OrdersPage()
].elementAt(index);
},
};
}
Widget _buildOffstageNavigator(int index) {
var routeBuilders = _routeBuilders(context, index);
return Offstage(
offstage: _selectedIndex != index,
child: Navigator(
key: _navigatorKeys[index],
onGenerateRoute: (routeSettings) {
return MaterialPageRoute(
builder: (context) => routeBuilders[routeSettings.name]!(context),
);
},
),
);
}
}
You have used an offstage widget which will just remove the ui from the stage. It wont reload when the index is changed. You have to create a list
List screens = [
HomePage(),
ProductSearchPage(),
CustomerPage(),
OrdersPage()
],
//Then in body use
body: screens[index]
You can set the api call in on Tap because all the pages will be initialized at a time that's why you are facing this issue.
Just check the condition on Tap for a currently selected index and write down the API call there.
Related
It's my WebView project. I am facing runtime error while running on emulator .Code is running smoothly but issue is that dropdown button is not selecting any item. Second issue is that icons of bottom Navigation Bar is not appearing excepted selected icon.
[
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:togoparts_app/splash.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:dropdown_search/dropdown_search.dart';
void main() {
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
home: SplashScreen(),
));
}
class TogoParts extends StatefulWidget {
const TogoParts({Key? key}) : super(key: key);
#override
State<TogoParts> createState() => _TogoPartsState();
}
class _TogoPartsState extends State<TogoParts> {
List<String>list= [
"My Challenges",
"Current Challenges",
"Past Challenges"
];
String? currentItemSelected = "My Challenges";
int selectedItemIndex = 0;
late WebViewController webViewController;
List links = [
"https://www.togoparts.com/",
"https://www.togoparts.com/bikeprofile/trides",
"https://www.togoparts.com/marketplace/browse",
"https://www.togoparts.com/marketplace/create/",
];
#override
void initState() {
// TODO: implement initState
super.initState();
if (Platform.isAndroid) WebView.platform = AndroidWebView();
}
#override
Widget build(BuildContext context) {
int? selectedItemIndex = 0;
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(50),
child: AppBar(
backgroundColor: Colors.black,
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.black,
statusBarBrightness: Brightness.light,
statusBarIconBrightness: Brightness.light,
),
title: Container(
decoration: BoxDecoration(
color: Colors.black,
),`enter code here`
child: DropdownButton<String>(
alignment: AlignmentDirectional.topStart,
elevation: 10,
icon: Icon(Icons.keyboard_arrow_down),
style: TextStyle(color: Colors.black),
dropdownColor: Colors.white,
items: list.map<DropdownMenuItem<String>>(
(String dropdownStringItem) {
return DropdownMenuItem<String>(
value: dropdownStringItem,
child: Text(dropdownStringItem),
);
}).toList(),
// value: _currentItemSelected,
onChanged: ( String? newValueSelected) {
_onDropDownItemSelected(newValueSelected!);
value: currentItemSelected;
},
),
),
actions: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.email,
color: Colors.white,
)),
IconButton(onPressed: () {}, icon: Icon(Icons.notifications)),
IconButton(onPressed: () {}, icon: Icon(Icons.more_vert)),
],
),
),
body: Material(
child: WebView(
// initialUrl:' https://www.togoparts.com//'
initialUrl: links.elementAt(selectedItemIndex),
javascriptMode: JavascriptMode.unrestricted,
// initialUrl: links.elementAt(selectedItemIndex),
onWebViewCreated: (c) {
webViewController = c;
},
),
),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.wine_bar),
label: "CHALLENGE",
),
BottomNavigationBarItem(
icon: Icon(Icons.home_filled), label: "BOARD"),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), label: "ME"),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_bag_outlined), label: "MARKET"),
BottomNavigationBarItem(icon: Icon(Icons.more_horiz), label: "MORE")
],
currentIndex: selectedItemIndex,
selectedItemColor: Colors.orange,
backgroundColor: Colors.black,
unselectedItemColor: Colors.white,
iconSize: 30,
onTap: (index) {
setState(() {
webViewController.loadUrl(
links.elementAt(selectedItemIndex!),
);
selectedItemIndex = index;
});
},
),
);
}
void _onDropDownItemSelected(String newValueSelected){
setState(() {
this.currentItemSelected=newValueSelected;
});
}
}
plz review above code and tell me where is the mistake. How can I resolve my issue why dropdown items are not selecting and why bottom navigation bar icons having disappeard.
You need to remove selectedItemIndex from build method.
#override
Widget build(BuildContext context) {
// int? selectedItemIndex = 0;// remove this
And call value on DropdownButton
child: DropdownButton<String>(
alignment: AlignmentDirectional.topStart,
value: currentItemSelected,
items: list
.map<DropdownMenuItem<String>>((String dropdownStringItem) {
return DropdownMenuItem<String>(
value: dropdownStringItem,
child: Text(dropdownStringItem),
);
}).toList(),
// value: _currentItemSelected,
onChanged: (String? newValueSelected) {
_onDropDownItemSelected(newValueSelected!);
},
),
Full minimal snippet
class TogoParts extends StatefulWidget {
const TogoParts({Key? key}) : super(key: key);
#override
State<TogoParts> createState() => _TogoPartsState();
}
class _TogoPartsState extends State<TogoParts> {
List<String> list = [
"My Challenges",
"Current Challenges",
"Past Challenges"
];
String? currentItemSelected = "My Challenges";
int selectedItemIndex = 0;
List links = [
"https://www.togoparts.com/",
"https://www.togoparts.com/bikeprofile/trides",
"https://www.togoparts.com/marketplace/browse",
"https://www.togoparts.com/marketplace/create/",
];
#override
void initState() {
// TODO: implement initState
super.initState();
}
#override
Widget build(BuildContext context) {
// int? selectedItemIndex = 0;// remove this
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(50),
child: AppBar(
// backgroundColor: Colors.black,
title: Container(
decoration: BoxDecoration(
// color: Colors.black,
),
child: DropdownButton<String>(
alignment: AlignmentDirectional.topStart,
value: currentItemSelected,
items: list
.map<DropdownMenuItem<String>>((String dropdownStringItem) {
return DropdownMenuItem<String>(
value: dropdownStringItem,
child: Text(dropdownStringItem),
);
}).toList(),
// value: _currentItemSelected,
onChanged: (String? newValueSelected) {
_onDropDownItemSelected(newValueSelected!);
},
),
),
actions: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.email,
color: Colors.white,
)),
IconButton(onPressed: () {}, icon: Icon(Icons.notifications)),
IconButton(onPressed: () {}, icon: Icon(Icons.more_vert)),
],
),
),
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.wine_bar),
label: "CHALLENGE",
),
BottomNavigationBarItem(
icon: Icon(Icons.home_filled), label: "BOARD"),
BottomNavigationBarItem(
icon: Icon(Icons.account_circle), label: "ME"),
BottomNavigationBarItem(
icon: Icon(Icons.shopping_bag_outlined), label: "MARKET"),
BottomNavigationBarItem(icon: Icon(Icons.more_horiz), label: "MORE")
],
currentIndex: selectedItemIndex,
selectedItemColor: Colors.orange,
backgroundColor: Colors.black,
unselectedItemColor: Colors.white,
iconSize: 30,
onTap: (index) {
setState(() {
selectedItemIndex = index;
});
},
),
);
}
void _onDropDownItemSelected(String newValueSelected) {
setState(() {
currentItemSelected = newValueSelected;
});
}
}
I have question I hope to help me How can I call the binding of page Home when I press the tap of home on bottom navbar
**Controller of bottom navbar **
class BottomNavBarController extends GetxController{
List bodyPage=[
const Home(),
const Settings(),
const ProfileView()
];
NavBar
body:Obx(()=> navBarController.currentPage,
),
// bodyPage[navBarController.indexNavBar],
bottomNavigationBar:Obx(()=> NavigationBar(
currentIndex: navBarController.indexNavBar.value,
items: [
NavigationBarItem(
icon: const Icon(home_outline, ),
),
NavigationBarItem(
icon: const Icon(setting_outline),
),
NavigationBarItem(
icon: const Icon(menu_outline),
)])));
**Binding **
class HomeBinding implements Bindings{
#override
void dependencies() {
Get.put(HomeController());
}}
**Get Page **
getPages: [
GetPage(name: "/home", page:()=> const HomeView(), binding:HomeBinding()),
]
I use bottom navigation and Getx.
In this way :
changeNavigationIndex(int index) {
myPresenter.setMainNavigationIndex(index);
switch (index) {
case 1:
setState(() {
mainNavigationTitle = txtTitle2;
});
break;
case 2:
setState(() {
mainNavigationTitle = txtTitle3;
});
break;
case 3:
setState(() {
mainNavigationTitle = txtTitle4;
});
break;
case 0:
default:
setState(() {
mainNavigationTitle = txtTitle1;
});
break;
}
}
buildBottomNavigationMenu(context, MyPresenter myPresenter) {
changeNavigationIndex(myPresenter.mainNavigationIndex);
return Obx(() =>
MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: SizedBox(
child: BottomNavigationBar(
onTap: changeNavigationIndex,
type: BottomNavigationBarType.fixed,
currentIndex: salesPresenter.mainNavigationIndex,
selectedIconTheme: IconThemeData(
color: CustomColors.iconColor,
size: 30,
),
items: [
BottomNavigationBarItem(
icon: const Icon(Icons.icon1),
label: txt1,
backgroundColor: Theme.of(context).primaryColor,
),
BottomNavigationBarItem(
icon: const Icon(Icons.icon2),
label: txt2,
backgroundColor: Theme.of(context).primaryColor,
),
BottomNavigationBarItem(
icon: const Icon(Icons.icon3),
label: txt3,
backgroundColor: Theme.of(context).primaryColor,
),
BottomNavigationBarItem(
icon: const Icon(Icons.icon4),
label: txt4,
backgroundColor: Theme.of(context).primaryColor,
),
],
),
)
));
}
return
WillPopScope(
onWillPop: () async => false,
child: Scaffold(
body:
: GetX<MyPresenter>(
builder: (mp) => IndexedStack(
index: mp.mainNavigationIndex,
children: const[
Screen1(),
Screen2(),
Screen3(),
Screen4(),
],
)
),
bottomNavigationBar: buildBottomNavigationMenu(context, myPresenter),
drawer: const MainDrawerWidget(),
),
);
So, In this app all Getx Binding is in separated file (MainBind.dart) That I call on Main.dart.
But if you want call the bind in same file that u have programmated the bottom navigation, you can put the bind in your Main Class like this:
class _MainScreenState extends State<MainScreen> {
Get.lazyPut<MyPresenter>(() => MyPresenter(), fenix: true);
}
I have 4 pages in bottom navigation bar. I am facing a problem related to route that i want to route to a specific page in bottom navigation bar from another page?
e.g I am going to login page and post successful login I want to route user to accountdetails(AccountSetting) but if I am selecting account setting then in that page bottom navigation bar is not showing and if I am routing to bottom nav bar here I am unable to select index of my choice. How can I select index of my choice because I don't want to make new page having bottom nav bar?
class BottomNavBar extends StatefulWidget {
static String routeName = "/bottombar";
#override
_BottomNavBarState createState() => _BottomNavBarState();
}
class _BottomNavBarState extends State<BottomNavBar> {
CartCountController cartCountController = CartCountController();
DoublePressBackBotton doublePressBackBotton = DoublePressBackBotton();
int _selectedIndex = 0;
#override
void initState() {
Future.delayed(Duration(milliseconds: 1000)).then((value) {
cartCountController.cartItemCount();
});
super.initState();
}
#override
void dispose() {
Future.delayed(Duration(milliseconds: 1000)).then((value) {
cartCountController.cartItemCount();
});
super.dispose();
}
List _widgetOptions = [
HomeScreen(),
CategoryList(),
InviteFriend(),
AccountSetting(),
];
void _onItemTapped(
int index,
) {
setState(() {
_selectedIndex = index;
});
}
#override
Widget build(BuildContext context) {
return
// drawer: SideDrawer(),
body: WillPopScope(
child: _widgetOptions.elementAt(_selectedIndex),
onWillPop: () {
return doublePressBackBotton.doubleBack();
},
),
bottomNavigationBar: BottomNavigationBar(
// backgroundColor: Color(0xff202020),
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
backgroundColor: kPrimaryColor,
icon: Icon(
Icons.home_outlined,
color: Colors.white,
),
label: 'Home',
),
BottomNavigationBarItem(
backgroundColor: kPrimaryColor,
icon: Icon(
Icons.category,
color: Colors.white,
),
label: 'Category',
),
BottomNavigationBarItem(
backgroundColor: kPrimaryColor,
icon: ImageIcon(
AssetImage(AppImages.phonecall),
color: Colors.white,
),
label: 'Invite',
),
BottomNavigationBarItem(
backgroundColor: kPrimaryColor,
icon: Icon(
Icons.person_outlined,
color: Colors.white,
),
label: 'Account',
),
],
// fixedColor: Colors.black,
currentIndex: _selectedIndex,
// selectedItemColor: Color(0xffF9C000),
onTap: _onItemTapped,
showUnselectedLabels: true,
selectedItemColor: kPrimaryLightColor,
// unselectedItemColor: Color(0xff737373),
unselectedLabelStyle: GoogleFonts.lato(color: Colors.white),
selectedLabelStyle: GoogleFonts.lato(color: Colors.white),
),
);
// );
}
}
I am new to flutter. I have a question about scaffold in my project.
I have a home screen that I use to display the BottomNavigation widget. I guess that I also use if as a container to display all of the other pages/screens in so that the BottomNavigation will stay visible. Here is the code below:
class Home_Screen extends StatefulWidget {
static const String id = 'home_screen';
#override
_Home_ScreenState createState() => _Home_ScreenState();
}
// ignore: camel_case_types
class _Home_ScreenState extends State<Home_Screen> {
PageController _pageController = PageController();
List<Widget> _screens = [
AgentDashboardScreen(),
TransactionDetailScreen(),
AgentProfileScreen(),
];
int _selectedIndex = 0;
void _onPageChanged(int index) {
setState(() {
_selectedIndex = index;
});
}
void _itemTapped(int selectedIndex) {
if (selectedIndex == 3) {
Navigator.of(context).pushAndRemoveUntil(
// the new route
MaterialPageRoute(
builder: (BuildContext context) => WelcomeScreen(),
),
(Route route) => false,
);
} else {
_pageController.jumpToPage(selectedIndex);
}
}
#override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
controller: _pageController,
children: _screens,
onPageChanged: _onPageChanged,
physics: NeverScrollableScrollPhysics(),
),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
onTap: _itemTapped,
items: [
BottomNavigationBarItem(
icon: Icon(
Icons.home,
color: _selectedIndex == 0 ? Colors.blueAccent : Colors.grey,
),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(
Icons.account_balance,
color: _selectedIndex == 1 ? Colors.blueAccent : Colors.grey,
),
label: 'Add Tran',
),
BottomNavigationBarItem(
icon: Icon(
Icons.person,
color: _selectedIndex == 2 ? Colors.blueAccent : Colors.grey,
),
label: 'Profile',
),
BottomNavigationBarItem(
icon: Icon(
Icons.album_outlined,
color: _selectedIndex == 3 ? Colors.blueAccent : Colors.grey,
),
label: 'Logout',
),
],
),
);
}
}
In one of the screens that I can navigate to from the BottomNavigator I am having issues with a large white space above the keyboard. I have read that having a scaffold inside another scaffold can cause this.
So, when I navigate to the next page do I have a scaffold inside another scaffold? Here is a snippet from the second page.
class TransactionDetailScreen extends StatefulWidget {
static const String id = 'transaction_detail_screen';
final QueryDocumentSnapshot trxns;
//final Trxns trxns;
//final QuerySnapshot queryTrxns = trxns;
TransactionDetailScreen([this.trxns]);
#override
_TransactionDetailScreenState createState() =>
_TransactionDetailScreenState();
}
class _TransactionDetailScreenState extends State<TransactionDetailScreen> {
String _trxnStatus = 'Listed';
#override
Widget build(BuildContext context) {
// Get the stream of transactions created in main.dart
final trxnProvider = Provider.of<TrxnProvider>(context);
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assets/images/Appbar_logo.png',
fit: BoxFit.cover, height: 56),
],
),
),
backgroundColor: Colors.white,
body: SingleChildScrollView(
reverse: true,
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: <Widget>[
Text(
'Transaction Details',
style: TextStyle(
fontSize: 30,
),
),
SizedBox(
height: 8.0,
),
TextField(
autofocus: true,
keyboardType: TextInputType.text,
controller: clientFNameController,
textAlign: TextAlign.center,
onChanged: (value) {
trxnProvider.changeclientFName(value);
},
decoration: kTextFieldDecoration.copyWith(
hintText: 'Client First Name',
labelText: 'Client First Name'),
),
RoundedButton(
title: 'Save',
colour: Colors.blueAccent,
onPressed: () async {
setState(() {
showSpinner = true;
});
try {
trxnProvider.saveTrxn();
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => AgentDashboardScreen(),
),
);
setState(() {
showSpinner = false;
});
} catch (e) {
// todo: add better error handling
print(e);
}
},
),
SizedBox(
height: 8.0,
),
(widget != null)
? RoundedButton(
title: 'Delete',
colour: Colors.red,
onPressed: () async {
setState(() {
showSpinner = true;
});
try {
trxnProvider.deleteTrxn(widget.trxns['trxnId)']);
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => AgentDashboardScreen(),
),
);
setState(() {
showSpinner = false;
});
} catch (e) {
// todo: add better error handling
print(e);
}
},
)
: Container(),
],
),
),
),
);
}
}
The keyboard works/looks as expected (no white space above) if the textboxes are empty. Am I doing this correctly or should I do it differently?
Thanks
In Flutter Debug & Profile mode, I have a major performance issue. When I open my drawer, my app drops to about 20 FPS even in profile mode which is unacceptable. I've had issues like this that resolved by themselves in the past because Flutter (on startup) likes to use an old version of my app until I either hot reload or hot restart. But I've tried everything and still, the performance of my app is unacceptable. I just want to prevent my drawer from rebuilding itself every time the user opens it.
NOTE: The only time the app works well is in release mode.
CustomDrawer class:
int _selectedIndex = 0;
class CustomDrawer extends StatefulWidget {
get selectedIndex => _selectedIndex;
set selectedIndex(int newIndex) => _selectedIndex = newIndex;
final List<String> appRoutes = App.routes.keys.toList();
#override
_CustomDrawerState createState() => _CustomDrawerState();
}
class _CustomDrawerState extends State<CustomDrawer> {
final List<DrawerItem> _drawerItems = [
DrawerItem(
title: "Home",
icon: OMIcons.home,
),
DrawerItem(
title: "Assignments",
icon: OMIcons.assignment,
),
DrawerItem(
title: "Schedule",
icon: OMIcons.schedule,
),
DrawerItem(
title: "Subjects",
icon: OMIcons.subject,
),
DrawerItem(
title: "Settings",
icon: OMIcons.settings,
),
DrawerItem(
title: "Help and Feedback",
icon: OMIcons.help,
),
DrawerItem(
title: "Upgrade",
icon: OMIcons.star,
color: Colors.orange,
),
];
List<Widget> drawerOptions = [];
#override
void initState() {
super.initState();
_populateDrawerOptions();
}
void _populateDrawerOptions() {
for (var d in _drawerItems) {
var i = _drawerItems.indexOf(d);
drawerOptions.add(CustomListTile(
icon: d.icon,
topContainerColor:
_selectedIndex == i ? Color(0xffe8f0fe) : Colors.transparent,
iconColor: _selectedIndex == i ? Color(0xff1967d2) : d.color,
onTap: () => _onSelectItem(i),
text: d.title,
textColor: _selectedIndex == i ? Color(0xff1967d2) : d.color,
));
}
}
void _onSelectItem(int index) {
if (_selectedIndex == index) {
Navigator.of(context).pop();
return;
}
_selectedIndex = index;
Navigator.of(context).pushReplacementNamed(
widget.appRoutes[index],
);
}
final Widget drawerHeader = SafeArea(
top: true,
child: Container(
child: Text(
"School Life",
style: TextStyle(fontSize: 24.0, fontFamily: 'OpenSans'),
),
),
);
#override
Widget build(BuildContext context) {
final Color drawerColor = Theme.of(context).primaryColor;
return Drawer(
child: Container(
color: drawerColor,
child: Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
drawerHeader,
ListView(
padding: const EdgeInsets.only(top: 15, right: 10),
shrinkWrap: true,
children: drawerOptions,
),
],
),
),
);
}
}