|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_bar/home_app_bar.dart';
|
|
|
|
|
|
|
|
|
|
import '../../common_widgets/app_bottom_nav_bar.dart';
|
|
|
|
|
import '../../common_widgets/app_drawer.dart';
|
|
|
|
|
import '../../common_widgets/app_floating_button.dart';
|
|
|
|
|
import 'dashboard_page.dart';
|
|
|
|
|
|
|
|
|
|
class LandPage extends StatefulWidget {
|
|
|
|
|
static const String routeName = "/land-page";
|
|
|
|
|
const LandPage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<LandPage> createState() => _LandPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _LandPageState extends State<LandPage> {
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
int currentPageIndex = 0;
|
|
|
|
|
static const List<Widget> _pages = <Widget>[
|
|
|
|
|
DashboardPage(),
|
|
|
|
|
Text('Index 1'),
|
|
|
|
|
Text('Index 2'),
|
|
|
|
|
Text('Index 3'),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return WillPopScope(
|
|
|
|
|
onWillPop: () async {
|
|
|
|
|
/// TODO [zaid] : show dialog before exit
|
|
|
|
|
// bool result = await showDialog(
|
|
|
|
|
// context: context,
|
|
|
|
|
// builder: (_) => const AAlertDialog(
|
|
|
|
|
// title: "_subtitle.exit",
|
|
|
|
|
// content: "_subtitle.exitAlert",
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
if (true) {
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
|
|
|
|
|
} else {
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
key: _scaffoldKey,
|
|
|
|
|
appBar: HomeAppBar(scaffoldKey:_scaffoldKey),
|
|
|
|
|
body: Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 16.toScreenWidth, top: 11.toScreenHeight),
|
|
|
|
|
child: _pages[currentPageIndex],
|
|
|
|
|
),
|
|
|
|
|
drawer: const AppDrawer(),
|
|
|
|
|
floatingActionButton: AppFloatingButton(
|
|
|
|
|
icon: Icons.add,
|
|
|
|
|
onPressed: () {},
|
|
|
|
|
),
|
|
|
|
|
bottomNavigationBar: AppBottomNavigationBar(
|
|
|
|
|
onPressed: (index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
currentPageIndex = index;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|