router and assets updated
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:tm_app/views/detail/detail_screen.dart';
|
||||
import 'package:tm_app/views/login/login_screen.dart';
|
||||
|
||||
import '../../views/home/home_screen.dart';
|
||||
import '../../views/profile/profile_screen.dart';
|
||||
import '../../views/tenders/tenders_screen.dart';
|
||||
@@ -20,7 +22,7 @@ final GlobalKey<NavigatorState> profileNavigatorKey =
|
||||
// Main app router
|
||||
final GoRouter appRouter = GoRouter(
|
||||
routes: $appRoutes,
|
||||
initialLocation: '/home',
|
||||
initialLocation: '/login',
|
||||
navigatorKey: rootNavigatorKey,
|
||||
);
|
||||
|
||||
@@ -31,7 +33,7 @@ class LoginScreenRoute extends GoRouteData with _$LoginScreenRoute {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const TenderDetailScreen();
|
||||
return const LoginScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,3 +146,13 @@ class YourTendersRouteData extends GoRouteData with _$YourTendersRouteData {
|
||||
return const YourTendersScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@TypedGoRoute<TenderDetailRouteData>(path: '/tender-detail')
|
||||
class TenderDetailRouteData extends GoRouteData with _$TenderDetailRouteData {
|
||||
const TenderDetailRouteData();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const TenderDetailScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ List<RouteBase> get $appRoutes => [
|
||||
$loginScreenRoute,
|
||||
$appShellRouteData,
|
||||
$yourTendersRouteData,
|
||||
$tenderDetailRouteData,
|
||||
];
|
||||
|
||||
RouteBase get $loginScreenRoute =>
|
||||
@@ -165,3 +166,30 @@ mixin _$YourTendersRouteData on GoRouteData {
|
||||
@override
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
RouteBase get $tenderDetailRouteData => GoRouteData.$route(
|
||||
path: '/tender-detail',
|
||||
|
||||
factory: _$TenderDetailRouteData._fromState,
|
||||
);
|
||||
|
||||
mixin _$TenderDetailRouteData on GoRouteData {
|
||||
static TenderDetailRouteData _fromState(GoRouterState state) =>
|
||||
const TenderDetailRouteData();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/tender-detail');
|
||||
|
||||
@override
|
||||
void go(BuildContext context) => context.go(location);
|
||||
|
||||
@override
|
||||
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
|
||||
|
||||
@override
|
||||
void pushReplacement(BuildContext context) =>
|
||||
context.pushReplacement(location);
|
||||
|
||||
@override
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user