import 'package:flutter/material.dart'; import 'package:robo_advisory/providers/user_provider.dart'; import 'package:robo_advisory/screens/dashboard/local_widgets/bottom_navigation.dart'; import 'package:robo_advisory/screens/home/home.dart'; import 'package:robo_advisory/screens/fund_transfer/fund_transfer.dart'; import 'package:robo_advisory/screens/settlement/settlement.dart'; import 'package:robo_advisory/screens/history/history.dart'; import 'package:robo_advisory/widgets/drawer.dart'; import 'package:provider/provider.dart'; class DashboardScreen extends StatefulWidget { @override _DashboardScreenState createState() => _DashboardScreenState(); } class _DashboardScreenState extends State { final GlobalKey _scaffoldKey = GlobalKey(); void _openEndDrawer() { _scaffoldKey.currentState.openEndDrawer(); } @override Widget build(BuildContext context) { int _selectedIndex = Provider.of(context, listen: true).selectedTabIndex; void _onItemTapped(int index) { Provider.of(context, listen: false) .setSelectedTabIndex(index); } var currentTab = [ HomeScreen( toggleDrawer: _openEndDrawer, ), FundTransferScreen(), SettlementScreen(), HistoryScreen(), ]; return Scaffold( key: _scaffoldKey, backgroundColor: Colors.white, body: currentTab[_selectedIndex], endDrawer: AppDrawer(), bottomNavigationBar: BottomNavigation( selectedIndex: _selectedIndex, onItemTapped: _onItemTapped, )); } }