added notifications and change in forgot password
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:tm_app/views/home/pages/home_screen.dart';
|
||||
import 'package:tm_app/views/login/pages/login_screen.dart';
|
||||
|
||||
import '../../views/forgot_password/pages/forgot_password_screen.dart';
|
||||
import '../../views/notification/pages/notification_screen.dart';
|
||||
import '../../views/profile/pages/profile_screen.dart';
|
||||
import '../../views/tenders/pages/tenders_screen.dart';
|
||||
import '../../views/your_tenders/pages/your_tenders_screen.dart';
|
||||
@@ -19,11 +20,13 @@ final GlobalKey<NavigatorState> tendersNavigatorKey =
|
||||
GlobalKey<NavigatorState>();
|
||||
final GlobalKey<NavigatorState> profileNavigatorKey =
|
||||
GlobalKey<NavigatorState>();
|
||||
final GlobalKey<NavigatorState> notificationNavigatorKey =
|
||||
GlobalKey<NavigatorState>();
|
||||
|
||||
// Main app router
|
||||
final GoRouter appRouter = GoRouter(
|
||||
routes: $appRoutes,
|
||||
initialLocation: '/login',
|
||||
initialLocation: '/notification',
|
||||
navigatorKey: rootNavigatorKey,
|
||||
);
|
||||
|
||||
@@ -56,6 +59,11 @@ class LoginScreenRoute extends GoRouteData with _$LoginScreenRoute {
|
||||
TypedGoRoute<ProfileRouteData>(path: '/profile'),
|
||||
],
|
||||
),
|
||||
TypedStatefulShellBranch<NotificationBranch>(
|
||||
routes: <TypedRoute<RouteData>>[
|
||||
TypedGoRoute<NotificationRouteData>(path: '/notification'),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
class AppShellRouteData extends StatefulShellRouteData {
|
||||
@@ -89,6 +97,12 @@ class ProfileBranch extends StatefulShellBranchData {
|
||||
static final GlobalKey<NavigatorState> $navigatorKey = profileNavigatorKey;
|
||||
}
|
||||
|
||||
class NotificationBranch extends StatefulShellBranchData {
|
||||
const NotificationBranch();
|
||||
static final GlobalKey<NavigatorState> $navigatorKey =
|
||||
notificationNavigatorKey;
|
||||
}
|
||||
|
||||
// Route data classes
|
||||
class HomeRouteData extends GoRouteData with _$HomeRouteData {
|
||||
const HomeRouteData();
|
||||
@@ -138,6 +152,15 @@ class ProfileRouteData extends GoRouteData with _$ProfileRouteData {
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationRouteData extends GoRouteData with _$NotificationRouteData {
|
||||
const NotificationRouteData();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const NotificationScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@TypedGoRoute<YourTendersRouteData>(path: '/your-tenders')
|
||||
class YourTendersRouteData extends GoRouteData with _$YourTendersRouteData {
|
||||
const YourTendersRouteData();
|
||||
|
||||
@@ -71,6 +71,17 @@ RouteBase get $appShellRouteData => StatefulShellRouteData.$route(
|
||||
),
|
||||
],
|
||||
),
|
||||
StatefulShellBranchData.$branch(
|
||||
navigatorKey: NotificationBranch.$navigatorKey,
|
||||
|
||||
routes: [
|
||||
GoRouteData.$route(
|
||||
path: '/notification',
|
||||
|
||||
factory: _$NotificationRouteData._fromState,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -141,6 +152,27 @@ mixin _$ProfileRouteData on GoRouteData {
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
mixin _$NotificationRouteData on GoRouteData {
|
||||
static NotificationRouteData _fromState(GoRouterState state) =>
|
||||
const NotificationRouteData();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/notification');
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
RouteBase get $yourTendersRouteData => GoRouteData.$route(
|
||||
path: '/your-tenders',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user