123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- import 'package:lszlgl/base/base_lifecycle_state.dart';
- import 'package:lszlgl/page/login/login_page.dart';
- import 'package:lszlgl/page/main_tab_page.dart';
- import 'package:lszlgl/page/print/connect_print_page.dart';
- import 'package:lszlgl/page/print/print_page.dart';
- import 'package:lszlgl/page/sample_task/reap_sample_detail/reap_sample_task_page.dart';
- import 'package:lszlgl/page/sample_task/sample_task_list_tab_page.dart';
- import 'package:lszlgl/page/user_center/account_manage_page.dart';
- import 'package:lszlgl/page/user_center/change_pwd_page.dart';
- import 'package:lszlgl/page/user_center/setting_page.dart';
- import 'package:lszlgl/router/my_navigator.dart';
- import '../page/qrcode_scan/qrcode_scan_page.dart';
- import '../page/sample_task/stock_sample_detail/stock_sample_task_page.dart';
- import '../page/signature/signature_page.dart';
- // 根页面
- const rLoginPage = '/';
- // 主页
- const rMainTabPage = '/MainTabPage';
- // 账号管理
- const rAccountManagePage = '/AccountManagePage';
- // 设置
- const rSettingPage = '/SettingPage';
- // 修改密码
- const rChangePwdPage = '/ChangePwdPage';
- // 收获流程列表
- const rSampleTaskListTabPage = '/SampleTaskListTabPage';
- // 收获扦样任务
- const rReapSampleTaskPage = '/ReapSampleTaskPage';
- // 库存扦样任务
- const rStockSampleTaskPage = '/StockSampleTaskPage';
- // 电子签名
- const rSignaturePage = '/SignaturePage';
- // 打印
- const rPrintPage = '/PrintPage';
- // 连接
- const rConnectPrintPage = '/ConnectPrintPage';
- // 扫一扫
- const rQrCodeScanPage = '/QrCodeScanPage';
- final Map<String, MyNavigatorBuilder> rRouteMap = {
- // 根页面
- rLoginPage: (context, args) => const LoginPage(),
- rMainTabPage: (context, args) => const MainTabPage(),
- rAccountManagePage: (context, args) => const AccountManagePage(),
- rSettingPage: (context, args) => const SettingPage(),
- rChangePwdPage: (context, args) => const ChangePwdPage(),
- rSampleTaskListTabPage: (context, args) => SampleTaskListTabPage(args: args as SampleTaskListTabPageArgs?),
- rReapSampleTaskPage: (context, args) => ReapSampleTaskPage(args: args as ReapSampleTaskPageArgs),
- rStockSampleTaskPage: (context, args) => StockSampleTaskPage(args: args as StockSampleTaskPageArgs),
- rSignaturePage: (context, args) => SignaturePage(args: args as SignaturePageArgs),
- rPrintPage: (context, args) => PrintPage(args: args as PrintPageArgs),
- rConnectPrintPage: (context, args) => ConnectPrintPage(args: args as ConnectPrintPageArgs),
- rQrCodeScanPage: (context, args) => const QrCodeScanPage(),
- };
- class MyRouter {
- MyRouter._();
- /// 登录
- static void startLogin({bool popAll = false}) {
- if (popAll) {
- MyNavigator.pushRemoveUntil(rLoginPage, (route) => false);
- } else {
- MyNavigator.push(rLoginPage);
- }
- }
- /// 主页
- static void startMain({bool popAll = false}) {
- if (popAll) {
- MyNavigator.pushRemoveUntil(rMainTabPage, (route) => false);
- } else {
- MyNavigator.push(rMainTabPage);
- }
- }
- /// 账号管理
- static void startAccountManage() {
- MyNavigator.push(rAccountManagePage);
- }
- /// 设置
- static void startSetting() {
- MyNavigator.push(rSettingPage);
- }
- /// 修改密码
- static void startChangePwd() {
- MyNavigator.push(rChangePwdPage);
- }
- /// 收获环节列表
- static Future<dynamic> startSampleTaskList(SampleTaskListTabPageArgs args) {
- return MyNavigator.push(rSampleTaskListTabPage, args: args);
- }
- /// 收获扦样任务
- static Future<dynamic> startReapSampleTask({ReapSampleTaskPageArgs? args, bool replace = false}) async {
- args ??= ReapSampleTaskPageArgs();
- if (replace) {
- return MyNavigator.pushReplace(rReapSampleTaskPage, args: args);
- } else {
- return MyNavigator.push(rReapSampleTaskPage, args: args);
- }
- }
- /// 库存扦样任务
- static Future<dynamic> startStockSampleTask({StockSampleTaskPageArgs? args}) {
- return MyNavigator.push(rStockSampleTaskPage, args: args ?? StockSampleTaskPageArgs());
- }
- /// 电子签名
- static Future<dynamic> startSignature({SignaturePageArgs? args}) {
- return MyNavigator.push(rSignaturePage, args: args ?? SignaturePageArgs());
- }
- /// 打印任务
- static Future<dynamic> startPrint(PrintPageArgs args) {
- return MyNavigator.push(rPrintPage, args: args);
- }
- /// 打印任务
- static Future<dynamic> startConnectPrint({ConnectPrintPageArgs? args}) {
- return MyNavigator.push(
- rConnectPrintPage, args: args ?? ConnectPrintPageArgs());
- }
-
- /// 扫一扫
- static Future<dynamic> startQrCodeScan() {
- return MyNavigator.push(rQrCodeScanPage);
- }
- }
|