import 'package:flutter/material.dart'; import '../screen/change_password_screen/change_password_screen.dart'; import '../screen/input_pekerjaan/input_pekerjaan_lain_lain.dart'; import '../screen/input_pekerjaan/input_pekerjaan_pengambilan_bahan.dart'; import '../screen/personal_information_screen/personal_information_screen.dart'; import '../screen/test/test_home_screen.dart'; import '../screen/work_process_screen/work_process_screen.dart'; import '../screen/input_pekerjaan/input_lain_lain_screen.dart'; import '../screen/input_pekerjaan/input_pekerjaan_pengantaran_hasil.dart'; import '../screen/input_pekerjaan/input_pekerjaan_screen.dart'; import '../screen/input_pekerjaan/input_pengambilan_bahan_screen.dart'; import '../screen/input_pekerjaan/input_pengantaran_hasil_dokter_screen.dart'; import '../screen/input_pekerjaan/input_pengantaran_hasil_instansi_screen.dart'; import '../screen/input_pekerjaan/input_pengantaran_hasil_pasien_screen.dart'; import '../screen/input_pekerjaan/input_scan_screen.dart'; import '../screen/konfirmasi/konfirmasi_screen.dart'; import '../screen/login/login_screen.dart'; import '../screen/problemlogin/problem_login_screen.dart'; import '../screen/splash_screen/splash_screen.dart'; import '../screen/menu_screen/menu_screen.dart'; // import '../screen/splash_screen.dart'; const splashRoute = "/splashRoute"; const loginRoute = "/loginRoute"; const problemLoginRoute = "/problemLoginRoute"; const testHomeRoute = "/testHomeRoute"; const inputPekerjaan = "/inputPekerjaan"; const inputScanRoute = "/inputScanRoute"; const konfirmasiRoute = "/konfirmasiRoute"; const inputPengantaranHasilPasien = "/inputPengantaranHasilPasien"; const inputPengantaranHasilInstansi = "/inputPengantaranHasilInstansi"; const inputPengantaranHasilDokter = "/inputPengantaranHasilDokter"; const inputPengambilanBahan = "/inputPengambilanBahan"; const inputLainLain = "/inputLainLain"; const personalInformationRoute = "/personalInformation"; const changePasswordRoute = "/changPassword"; const workProcessRoute = "/workProcessRoute"; const menuRoute = "/menuRoute"; const inputPekerjaanPengantaranHasil = "/inputPekerjaanPengantaranHasil"; const inputPekerjaanPengambilanBahan = "/inputPekerjaanPengambilanBahan"; const inputPekerjaanLainLain = "/inputPekerjaanLainLain"; class inputPekerjaanProp { final int input; final int tipe; inputPekerjaanProp(this.input, this.tipe); } class InputScanPekerjaanProp { final int input; final int tipe; InputScanPekerjaanProp(this.input, this.tipe); } class AppRoute { static Route generateRoute(RouteSettings settings) { // splash screen if (settings.name == splashRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const SplashScreen()); }); } // login if (settings.name == loginRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const LoginScreen()); }); } // problem login if (settings.name == problemLoginRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const ProblemLoginScreen()); }); } // test home screen if (settings.name == testHomeRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const TestHomeScreen()); }); } // test Menu screen if (settings.name == menuRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const MenuScreen()); }); } // input pekerjaan if (settings.name == inputPekerjaan) { final inputPekerjaanProp args = settings.arguments as inputPekerjaanProp; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputPekerjaan( input: args.input, tipe: args.tipe, )); }); } // input pekerjaan pengantaran hasil if (settings.name == inputPekerjaanPengantaranHasil) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const InputPekerjaanPengantaranHasil()); }); } // input pekerjaan pengambilan bahan if (settings.name == inputPekerjaanPengambilanBahan) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const InputPekerjaanPengambilanBahan()); }); } // input pekerjaan lain lain if (settings.name == inputPekerjaanLainLain) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const InputPekerjaanPekerjaanLainLain()); }); } // input pengantaran hasil pasien if (settings.name == inputPengantaranHasilPasien) { final args = settings.arguments as Map; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputPengantaranHasilPasienScreen( data: args, )); }); } // input pengantaran hasil instansi if (settings.name == inputPengantaranHasilInstansi) { final args = settings.arguments as Map; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context) .copyWith(textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputPengantaranHasilInstansiScreen( data: args, ), ); }); } // input pengantaran hasil dokter if (settings.name == inputPengantaranHasilDokter) { final args = settings.arguments as Map; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context) .copyWith(textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputPengantaranHasilDokterScreen( data: args, ), ); }); } // input pengambilan bahan if (settings.name == inputPengambilanBahan) { final args = settings.arguments as Map; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context) .copyWith(textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputPengambilanBahanScreen( data: args, ), ); }); } // input lain lain if (settings.name == inputLainLain) { final args = settings.arguments as Map; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context) .copyWith(textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputLainLain( data: args, ), ); }); } // input scan if (settings.name == inputScanRoute) { // final args = settings.arguments as Map; final InputScanPekerjaanProp args = settings.arguments as InputScanPekerjaanProp; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context) .copyWith(textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: InputScanScreen( data: args, ), ); }); } // konfirmasi if (settings.name == konfirmasiRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const KonfirmasiScreen()); }); } // Informasi Pribadi if (settings.name == personalInformationRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const PersonalInformationScreen()); }); } if (settings.name == changePasswordRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const ChangePasswordScreen()); }); } if (settings.name == workProcessRoute) { final args = settings.arguments as DetailWorkProp; return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: WorkProcessScreen( data: args, )); }); } return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context) .copyWith(textScaleFactor: 1.0, padding: const EdgeInsets.all(0)), child: const SplashScreen()); }); } }