init
This commit is contained in:
commit
8e54cfffc5
91 changed files with 2686 additions and 0 deletions
28
lib/features/core/abstracts/router/app_router.dart
Normal file
28
lib/features/core/abstracts/router/app_router.dart
Normal file
|
@ -0,0 +1,28 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:mc_gallery/features/home/views/gallery_view.dart';
|
||||
|
||||
import '../../views/error_page_view.dart';
|
||||
import 'routes.dart';
|
||||
|
||||
class McgRouter {
|
||||
static final _mcgRouter = McgRouter();
|
||||
final router = GoRouter(
|
||||
initialLocation: Routes.home.routePath,
|
||||
debugLogDiagnostics: true,
|
||||
errorPageBuilder: (context, state) => MaterialPage<void>(
|
||||
key: state.pageKey,
|
||||
child: ErrorPageView(error: state.error),
|
||||
),
|
||||
// TODO Add Redirect
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: Routes.home.routePath,
|
||||
name: Routes.home.routeName,
|
||||
builder: (context, _) => const GalleryView(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
static McgRouter get locate => _mcgRouter;
|
||||
}
|
27
lib/features/core/abstracts/router/routes.dart
Normal file
27
lib/features/core/abstracts/router/routes.dart
Normal file
|
@ -0,0 +1,27 @@
|
|||
enum Routes {
|
||||
home(RoutesInfo(
|
||||
routePath: '/gallery',
|
||||
routeName: 'Home',
|
||||
)),
|
||||
imageCarousel(RoutesInfo(
|
||||
routePath: '/image_carousel',
|
||||
routeName: 'Image Carousel',
|
||||
));
|
||||
|
||||
final RoutesInfo _routeInfo;
|
||||
|
||||
String get routePath => _routeInfo.routePath;
|
||||
String get routeName => _routeInfo.routeName;
|
||||
|
||||
const Routes(this._routeInfo);
|
||||
}
|
||||
|
||||
class RoutesInfo {
|
||||
final String routePath;
|
||||
final String routeName;
|
||||
|
||||
const RoutesInfo({
|
||||
required this.routePath,
|
||||
required this.routeName,
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue