first commit
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../middleware/auth_middleware.dart';
|
||||
import '../modules/dashboard/bindings/dashboard_binding.dart';
|
||||
import '../modules/dashboard/views/dashboard_view.dart';
|
||||
import '../modules/home/bindings/home_binding.dart';
|
||||
import '../modules/home/views/home_view.dart';
|
||||
import '../modules/login/bindings/login_binding.dart';
|
||||
import '../modules/login/views/login_view.dart';
|
||||
import '../modules/product_details/bindings/product_details_binding.dart';
|
||||
import '../modules/product_details/views/product_details_view.dart';
|
||||
import '../modules/products/bindings/products_binding.dart';
|
||||
import '../modules/products/views/products_view.dart';
|
||||
import '../modules/profile/bindings/profile_binding.dart';
|
||||
import '../modules/profile/views/profile_view.dart';
|
||||
import '../modules/root/bindings/root_binding.dart';
|
||||
import '../modules/root/views/root_view.dart';
|
||||
import '../modules/settings/bindings/settings_binding.dart';
|
||||
import '../modules/settings/views/settings_view.dart';
|
||||
|
||||
part 'app_routes.dart';
|
||||
|
||||
class AppPages {
|
||||
AppPages._();
|
||||
|
||||
static const INITIAL = Routes.HOME;
|
||||
|
||||
static final routes = [
|
||||
GetPage(
|
||||
name: '/',
|
||||
page: () => RootView(),
|
||||
binding: RootBinding(),
|
||||
participatesInRootNavigator: true,
|
||||
preventDuplicates: true,
|
||||
children: [
|
||||
GetPage(
|
||||
middlewares: [
|
||||
//only enter this route when not authed
|
||||
EnsureNotAuthedMiddleware(),
|
||||
],
|
||||
name: _Paths.LOGIN,
|
||||
page: () => LoginView(),
|
||||
binding: LoginBinding(),
|
||||
),
|
||||
GetPage(
|
||||
preventDuplicates: true,
|
||||
name: _Paths.HOME,
|
||||
page: () => HomeView(),
|
||||
bindings: [
|
||||
HomeBinding(),
|
||||
],
|
||||
title: null,
|
||||
children: [
|
||||
GetPage(
|
||||
name: _Paths.DASHBOARD,
|
||||
page: () => DashboardView(),
|
||||
binding: DashboardBinding(),
|
||||
),
|
||||
GetPage(
|
||||
middlewares: [
|
||||
//only enter this route when authed
|
||||
EnsureAuthMiddleware(),
|
||||
],
|
||||
name: _Paths.PROFILE,
|
||||
page: () => ProfileView(),
|
||||
title: 'Profile',
|
||||
transition: Transition.size,
|
||||
binding: ProfileBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.PRODUCTS,
|
||||
page: () => ProductsView(),
|
||||
title: 'Products',
|
||||
transition: Transition.zoom,
|
||||
binding: ProductsBinding(),
|
||||
children: [
|
||||
GetPage(
|
||||
name: _Paths.PRODUCT_DETAILS,
|
||||
page: () => ProductDetailsView(),
|
||||
binding: ProductDetailsBinding(),
|
||||
middlewares: [
|
||||
//only enter this route when authed
|
||||
EnsureAuthMiddleware(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
GetPage(
|
||||
name: _Paths.SETTINGS,
|
||||
page: () => SettingsView(),
|
||||
binding: SettingsBinding(),
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
part of 'app_pages.dart';
|
||||
// DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart
|
||||
|
||||
abstract class Routes {
|
||||
static const HOME = _Paths.HOME;
|
||||
|
||||
static const PROFILE = _Paths.HOME + _Paths.PROFILE;
|
||||
static const SETTINGS = _Paths.SETTINGS;
|
||||
|
||||
static const PRODUCTS = _Paths.HOME + _Paths.PRODUCTS;
|
||||
|
||||
static const LOGIN = _Paths.LOGIN;
|
||||
static const DASHBOARD = _Paths.HOME + _Paths.DASHBOARD;
|
||||
Routes._();
|
||||
static String LOGIN_THEN(String afterSuccessfulLogin) =>
|
||||
'$LOGIN?then=${Uri.encodeQueryComponent(afterSuccessfulLogin)}';
|
||||
static String PRODUCT_DETAILS(String productId) => '$PRODUCTS/$productId';
|
||||
}
|
||||
|
||||
abstract class _Paths {
|
||||
static const HOME = '/home';
|
||||
static const PRODUCTS = '/products';
|
||||
static const PROFILE = '/profile';
|
||||
static const SETTINGS = '/settings';
|
||||
static const PRODUCT_DETAILS = '/:productId';
|
||||
static const LOGIN = '/login';
|
||||
static const DASHBOARD = '/dashboard';
|
||||
}
|
||||
Reference in New Issue
Block a user