Commit d2218509 authored by Dio Maulana's avatar Dio Maulana

perbaikan route agar muncul di url

parent 1237fbc3
......@@ -11,7 +11,7 @@ import 'package:tour_travel_agr/page/reset_password/reset_password.dart';
import 'package:tour_travel_agr/page/splash/splash.dart';
class Routes {
static const String splashRoute = "/";
static const String splashRoute = "/splash";
static const String loginRoute = "/login";
static const String registerRoute = "/register";
static const String verificationRoute = "/verification";
......@@ -29,35 +29,45 @@ class RouteGenerator {
static Route<dynamic> getRoute(RouteSettings routeSettings) {
switch (routeSettings.name) {
case Routes.splashRoute:
return pageRouteCustom(const SplashView());
return pageRouteCustom(const SplashView(),
nameRoute: Routes.splashRoute);
case Routes.loginRoute:
return pageRouteCustom(LoginView());
return pageRouteCustom(LoginView(), nameRoute: Routes.loginRoute);
case Routes.registerRoute:
return pageRouteCustom(const RegisterView());
return pageRouteCustom(const RegisterView(),
nameRoute: Routes.registerRoute);
case Routes.verificationRoute:
return pageRouteCustom(const OtpVerificationView());
return pageRouteCustom(const OtpVerificationView(),
nameRoute: Routes.verificationRoute);
case Routes.forgotPasswordRoute:
return pageRouteCustom(const ForgotPasswordView());
return pageRouteCustom(const ForgotPasswordView(),
nameRoute: Routes.forgotPasswordRoute);
case Routes.resetPasswordRoute:
return pageRouteCustom(const ResetPasswordView());
return pageRouteCustom(const ResetPasswordView(),
nameRoute: Routes.resetPasswordRoute);
case Routes.homeRoute:
return pageRouteCustom(const HomeView());
return pageRouteCustom(const HomeView(), nameRoute: Routes.homeRoute);
case Routes.profileRoute:
return pageRouteCustom(const ProfileView());
return pageRouteCustom(const ProfileView(),
nameRoute: Routes.profileRoute);
case Routes.changePasswordRoute:
return pageRouteCustom(const ChangePasswordView());
return pageRouteCustom(const ChangePasswordView(),
nameRoute: Routes.changePasswordRoute);
case Routes.editProfileRoute:
return pageRouteCustom(const EditProfileView());
return pageRouteCustom(const EditProfileView(),
nameRoute: Routes.editProfileRoute);
default:
return unDefinedRoute();
}
}
static PageRouteBuilder<dynamic> pageRouteCustom(Widget target) {
static PageRouteBuilder<dynamic> pageRouteCustom(Widget target,
{required String nameRoute}) {
return PageRouteBuilder(
pageBuilder: (context, a, b) => target,
transitionDuration: Duration.zero,
reverseTransitionDuration: Duration.zero,
settings: RouteSettings(name: nameRoute.replaceAll("/", "")),
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment