Application/medcify/lib/navigation/routes.dart

71 lines
4.1 KiB
Dart
Raw Normal View History

2022-09-26 06:33:52 +00:00
import 'package:flutter/material.dart';
import 'package:medcify/models/medicine_item.dart';
import 'package:medcify/models/order_item.dart';
import 'package:medcify/models/pincode_item.dart';
import 'package:medcify/pages/main/changeTiming/change_timing_page.dart';
import 'package:medcify/pages/main/changeUpiQr/change_upi_qr_page.dart';
import 'package:medcify/pages/main/deliveryPincodes/addPincode/add_pincode_page.dart';
import 'package:medcify/pages/main/deliveryPincodes/delivery_pincodes_page.dart';
import 'package:medcify/pages/main/deliveryPincodes/editPincode/edit_pincode_page.dart';
import 'package:medcify/pages/main/notification/notification_page.dart';
import 'package:medcify/pages/main/orders/order_detail_page.dart';
import 'package:medcify/pages/main/orders/prescription_view_page.dart';
import 'package:medcify/pages/main/plan/plan_page.dart';
import 'package:medcify/pages/main/products/addProduct/add_product_page.dart';
import 'package:medcify/pages/main/products/editProduct/edit_product_page.dart';
import 'package:medcify/pages/main/settings/return_policy_page.dart';
import 'package:medcify/pages/main/settings/upi_page.dart';
import 'package:medcify/pages/main/settings/wide_discount_page.dart';
import '../components/loading_dialog.dart';
import '../pages/login/verifyOtp/verify_otp_page.dart';
import '../pages/login/sendOtp/send_otp_page.dart';
import '../pages/main/changeProfile/change_profile_page.dart';
import '../pages/main/main_page.dart';
import '../pages/main/qrcode/qr_code_page.dart';
import '../pages/register/register_page.dart';
import '../pages/splash/splash_page.dart';
import 'fade_transition_route.dart';
Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
case '/':return FadeTransitionPageRouteBuilder(page: const SplashPage());
//login pages
case '/sendOtp':return FadeTransitionPageRouteBuilder(page: const SendOtpPage());
case '/verifyOtp':return FadeTransitionPageRouteBuilder(page: VerifyOtpPage(settings.arguments as String));
//register pages
case '/register':return FadeTransitionPageRouteBuilder(page: RegisterPage());
//main pages
case '/main':return FadeTransitionPageRouteBuilder(page: const MainPage());
case '/returnPolicy':return FadeTransitionPageRouteBuilder(page: ReturnPolicyPage(settings.arguments as String));
case '/wideDiscount':return FadeTransitionPageRouteBuilder(page: WideDiscountPage(settings.arguments as String));
case '/upi':return FadeTransitionPageRouteBuilder(page: UpiPage());
case '/plan':return FadeTransitionPageRouteBuilder(page: PlanPage(settings.arguments as bool));
case '/changeProfile':return FadeTransitionPageRouteBuilder(page: ChangeProfilePage());
case '/changeTiming':return FadeTransitionPageRouteBuilder(page: const ChangeTimingPage());
case '/deliveryPincodes':return FadeTransitionPageRouteBuilder(page: const DeliveringPincodesPage());
case '/addPincode':return FadeTransitionPageRouteBuilder(page: const AddPincodePage());
case '/editPincode':return FadeTransitionPageRouteBuilder(page: EditPincodePage(settings.arguments as PincodeItem));
case '/addProduct':return FadeTransitionPageRouteBuilder(page: const AddProductPage());
case '/editProduct':return FadeTransitionPageRouteBuilder(page: EditProductPage(settings.arguments as MedicineItem));
case '/notification':return FadeTransitionPageRouteBuilder(page: const NotificationPage());
case '/orderDetail':return FadeTransitionPageRouteBuilder(page: OrderDetailPage(settings.arguments as OrderItem));
case '/qrcode':return FadeTransitionPageRouteBuilder(page: const QrCodePage());
case '/upiQr':return FadeTransitionPageRouteBuilder(page: const ChangeUpiQrPage());
case '/prescriptionView':return FadeTransitionPageRouteBuilder(page: PrescriptionView(settings.arguments as String));
case '/loading':return FadeTransitionPageRouteBuilder(page: const LoadingDialog());
default:
return MaterialPageRoute(builder: (_) {
return const Scaffold(
body: Center(
child: Text('404 Page not found'),
),
);
}
);
}
}