import 'package:app_petty_cash/screen/home/homepage_screen.dart'; import '../screen/change_company/change_company.dart'; import 'package:flutter/material.dart'; import '../screen/home/home_screen.dart'; import '../screen/transaksi/history_transaksi_screen.dart'; import '../screen/transaksi/transaksi_screen.dart'; import '../screen/login/login_screen.dart'; import '../screen/splash/splash_screen.dart'; import '../screen/test_file_picker/test_file_picker.dart'; import '../screen/report/report_screen.dart'; import '../screen/user/user_screen.dart'; const loginRoute = "/loginRoute"; const menuRoute = "/menuRoute"; const splashScreen = "/splashScreen"; const homeRoute = "/homeRoute"; const transaksiRoute = "/transaksiRoute"; const userRoute = "/userRoute"; const reportRoute = "/reportRoute"; const changeCompanyRoute = "/changeCompanyRoute"; const historyTransaksiRoute = "/historyTransaksiRoute"; // test screen const testFilePickerRoute = "/testFilePickerRoute"; class AppRoute { static Route generateRoute(RouteSettings settings) { // splash screen if (settings.name == splashScreen) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: SplashScreen(), ); }); } // change Company if (settings.name == changeCompanyRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: ChangeCompanyScreen(), ); }); } // history transaksi if (settings.name == historyTransaksiRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: HistoryTransaksiScreen(), ); }); } // report screen if (settings.name == reportRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: ReportScreen(), ); }); } // user screen if (settings.name == userRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: UserScreen(), ); }); } // home screen if (settings.name == homeRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), // child: HomeScreen(), child: HomePageScreen(), ); }); } // transaksi screen if (settings.name == transaksiRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: TransaksiScreen(), ); }); } // test file picker screen if (settings.name == testFilePickerRoute) { return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: EdgeInsets.all(0), ), child: TestFilePicker(), ); }); } // default return MaterialPageRoute(builder: (context) { return MediaQuery( data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, padding: const EdgeInsets.all(0), ), child: const LoginScreen(), ); }); } }