2020-05-05 13:21:37 +02:00
|
|
|
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
2020-05-10 18:29:43 +02:00
|
|
|
import 'package:comunic/ui/routes/main_route/page_info.dart';
|
2019-11-01 14:55:28 +01:00
|
|
|
import 'package:comunic/ui/screens/notifications_screen.dart';
|
2020-05-06 18:54:32 +02:00
|
|
|
import 'package:comunic/ui/widgets/mobile_mode/mobile_appbar_widget.dart';
|
2019-04-22 19:16:26 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
/// Main route of the application
|
|
|
|
///
|
|
|
|
/// @author Pierre HUBERT
|
|
|
|
|
2020-05-05 13:21:37 +02:00
|
|
|
class SmartphoneMainRoute extends StatefulWidget implements MainRoute {
|
2020-05-09 14:07:14 +02:00
|
|
|
const SmartphoneMainRoute({Key key}) : super(key: key);
|
|
|
|
|
2019-04-23 11:08:38 +02:00
|
|
|
@override
|
2020-04-17 15:26:37 +02:00
|
|
|
State<StatefulWidget> createState() => _MainRouteState();
|
2019-04-23 11:08:38 +02:00
|
|
|
}
|
|
|
|
|
2020-04-15 18:06:20 +02:00
|
|
|
/// Private implementation of HomeController
|
2020-05-09 14:18:09 +02:00
|
|
|
class _MainRouteState extends MainController {
|
2020-05-10 18:29:43 +02:00
|
|
|
@override
|
|
|
|
PageInfo get defaultPage =>
|
|
|
|
PageInfo(type: PageType.NOTIFICATIONS_PAGE, child: NotificationsScreen());
|
2020-04-15 16:03:04 +02:00
|
|
|
|
2019-04-22 19:16:26 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2019-07-01 11:51:23 +02:00
|
|
|
return Container(
|
|
|
|
color: Colors.blueAccent,
|
|
|
|
child: SafeArea(
|
|
|
|
// Avoid OS areas
|
|
|
|
child: WillPopScope(
|
2020-05-11 18:32:58 +02:00
|
|
|
onWillPop: willPop,
|
2019-07-01 11:51:23 +02:00
|
|
|
child: Scaffold(
|
2020-05-10 18:29:43 +02:00
|
|
|
appBar: currentPage.hideNavBar
|
2020-04-16 14:58:02 +02:00
|
|
|
? null
|
2020-05-10 18:29:43 +02:00
|
|
|
: ComunicMobileAppBar(currentPage: currentPage),
|
2020-05-11 13:40:48 +02:00
|
|
|
body: SafeArea(key: currentPage.key, child: currentPage.child),
|
2019-07-01 11:51:23 +02:00
|
|
|
),
|
2019-04-23 11:08:38 +02:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
2019-04-22 19:16:26 +02:00
|
|
|
}
|
2019-04-23 11:08:38 +02:00
|
|
|
}
|