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.
113 lines
3.4 KiB
Dart
113 lines
3.4 KiB
Dart
|
2 years ago
|
import 'dart:io';
|
||
|
|
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:flutter/services.dart';
|
||
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
||
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
||
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
||
|
|
|
||
|
|
import '../../common_widgets/app_drawer.dart';
|
||
|
|
import 'dashboard_page_indicator.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> {
|
||
|
|
PageController _controller;
|
||
|
|
int _currentPage = 1;
|
||
|
|
|
||
|
|
@override
|
||
|
|
void initState() {
|
||
|
|
super.initState();
|
||
|
|
_controller = PageController()
|
||
|
|
..addListener(() {
|
||
|
|
_currentPage = _controller.page.toInt() + 1;
|
||
|
|
setState(() {});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
void dispose() {
|
||
|
|
_controller.dispose();
|
||
|
|
super.dispose();
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return WillPopScope(
|
||
|
|
onWillPop: () async {
|
||
|
|
// 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(
|
||
|
|
appBar: AppBar(),
|
||
|
|
body: Padding(
|
||
|
|
padding: EdgeInsets.only(left: 16.toScreenWidth, top: 11.toScreenHeight),
|
||
|
|
child: Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
Row(
|
||
|
|
children: [
|
||
|
|
DashboardPageIndicator(index: 0, currentPage: _currentPage, controller: _controller),
|
||
|
|
3.width,
|
||
|
|
DashboardPageIndicator(index: 1, currentPage: _currentPage, controller: _controller),
|
||
|
|
3.width,
|
||
|
|
DashboardPageIndicator(index: 2, currentPage: _currentPage, controller: _controller),
|
||
|
|
10.width,
|
||
|
|
Text(
|
||
|
|
"0$_currentPage/03",
|
||
|
|
style: Theme.of(context).textTheme.labelMedium?.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.neutral40 : AppColor.neutral60),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
8.height,
|
||
|
|
Expanded(
|
||
|
|
child: PageView(
|
||
|
|
controller: _controller,
|
||
|
|
children: const [
|
||
|
|
Center(
|
||
|
|
child: Text('First Page'),
|
||
|
|
),
|
||
|
|
Center(
|
||
|
|
child: Text('Second Page'),
|
||
|
|
),
|
||
|
|
Center(
|
||
|
|
child: Text('Third Page'),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
bottomNavigationBar: BottomNavigationBar(
|
||
|
|
items: [
|
||
|
|
BottomNavigationBarItem(icon: Icon(Icons.add), label: "add"),
|
||
|
|
BottomNavigationBarItem(icon: Icon(Icons.add), label: "add"),
|
||
|
|
BottomNavigationBarItem(icon: Icon(Icons.add), label: "add"),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
drawer: const AppDrawer(),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|