import 'package:comunic/ui/routes/main_route/main_route.dart'; import 'package:comunic/ui/routes/main_route/page_info.dart'; import 'package:comunic/ui/screens/notifications_screen.dart'; import 'package:comunic/ui/widgets/mobile_mode/mobile_appbar_widget.dart'; import 'package:flutter/material.dart'; /// Main route of the application /// /// @author Pierre HUBERT class SmartphoneMainRoute extends StatefulWidget implements MainRoute { const SmartphoneMainRoute({Key key}) : super(key: key); @override State createState() => _MainRouteState(); } /// Private implementation of HomeController class _MainRouteState extends MainController { @override PageInfo get defaultPage => PageInfo(type: PageType.NOTIFICATIONS_PAGE, child: NotificationsScreen()); /// Allows to go to previous tab Future _willPop() async { if (numberOfPages == 1) return true; popPage(); return false; } @override Widget build(BuildContext context) { return Container( color: Colors.blueAccent, child: SafeArea( // Avoid OS areas child: WillPopScope( onWillPop: _willPop, child: Scaffold( appBar: currentPage.hideNavBar ? null : ComunicMobileAppBar(currentPage: currentPage), body: SafeArea(child: currentPage.child), ), ), ), ); } }