mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-29 16:26:27 +00:00
51 lines
1.4 KiB
Dart
51 lines
1.4 KiB
Dart
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<StatefulWidget> 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<bool> _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),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|