You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/new_views/pages/land_page/land_page.dart

84 lines
2.6 KiB
Dart

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/pages/land_page/home_app_bar.dart';
import 'package:test_sa/new_views/pages/land_page/my_assets_page.dart';
import 'package:test_sa/new_views/pages/land_page/my_requests_page.dart';
2 years ago
import '../../common_widgets/app_bottom_nav_bar.dart';
import '../../common_widgets/app_drawer.dart';
import '../../common_widgets/app_floating_action_button.dart';
import 'contact_us_bottom_sheet.dart';
2 years ago
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> {
2 years ago
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
2 years ago
int currentPageIndex = 0;
2 years ago
final List<Widget> _pages = const <Widget>[
2 years ago
DashboardPage(),
MyRequestsPage(),
MyAssetsPage(),
2 years ago
];
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
2 years ago
/// 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(
2 years ago
key: _scaffoldKey,
2 years ago
appBar: HomeAppBar(scaffoldKey: _scaffoldKey),
body: Padding(
padding: EdgeInsetsDirectional.only(start: 16.toScreenWidth, end: 11.toScreenHeight),
2 years ago
child: _pages[currentPageIndex],
),
drawer: const AppDrawer(),
floatingActionButton: const AppFloatingActionButton(),
2 years ago
bottomNavigationBar: AppBottomNavigationBar(
2 years ago
selectedIndex: currentPageIndex,
2 years ago
onPressed: (index) {
if (index == 3) {
showModalBottomSheet(
context: context,
useSafeArea: true,
backgroundColor: Colors.transparent,
builder: (context) => const ContactUsBottomSheet(),
);
} else {
setState(() {
currentPageIndex = index;
});
}
2 years ago
},
),
),
);
}
}