import 'package:flutter/material.dart'; import 'package:manager_app/Models/managerContext.dart'; import 'package:manager_app/Models/menu.dart'; import 'package:manager_app/Models/menuSection.dart'; import 'package:manager_app/Screens/Main/components/body.dart'; import 'package:manager_app/app_context.dart'; import 'package:manager_app/constants.dart'; import 'package:provider/provider.dart'; import 'package:responsive_framework/responsive_framework.dart'; class MainScreen extends StatefulWidget { MainScreen({Key? key}) : super(key: key); @override _MainScreenState createState() => _MainScreenState(); } class _MainScreenState extends State { @override Widget build(BuildContext context) { final appContext = Provider.of(context); ManagerAppContext managerAppContext = appContext.getContext(); var isFortSt = managerAppContext.instanceId == "633ee379d9405f32f166f047"; if(!ResponsiveBreakpoints.of(context).equals(TABLET) || isFortSt) { return Scaffold( body: Body(showDevice: !isFortSt), ); } else { return Scaffold( appBar: AppBar(title: Text("MyInfoMate", style: new TextStyle(color: kPrimaryColor, fontSize: 30, fontWeight: FontWeight.w400, fontFamily: "Helvetica")), backgroundColor: kSecond.withOpacity(0.3), iconTheme: IconThemeData(color: kPrimaryColor)), drawer: Drawer( child: getMenu() ), body: Body(showDevice: isFortSt), ); } } getMenu() { MenuSection devices = new MenuSection(name: "Tablettes", type: "devices", order: 0); MenuSection configurations = new MenuSection(name: "Configurations", type: "configurations", order: 1); // TODO Visites pour Fort St Héribert MenuSection resources = new MenuSection(name: "Ressources", type: "resources", order: 2); Menu menu = new Menu(title: "MyInfoMate"); return ListView( // Important: Remove any padding from the ListView. padding: EdgeInsets.zero, children: [ DrawerHeader( decoration: BoxDecoration( color: kPrimaryColor, ), child: Text(menu.title), ), ListTile( title: Text(devices.name), onTap: () { // TODO Navigate to configurations screen (by route if possible) }, ), ListTile( title: Text(configurations.name), onTap: () { // TODO Navigate to configurations screen (by route if possible) }, ), ListTile( title: Text(resources.name), onTap: () { // TODO Navigate to resources screen (by route if possible) }, ), ], ); } }