localizations fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:sf_app_platform/navigation/app_router.dart';
|
||||
@@ -27,14 +27,23 @@ class PlatformApp extends ConsumerWidget {
|
||||
),
|
||||
routerConfig: appRouter,
|
||||
debugShowCheckedModeBanner: false,
|
||||
|
||||
localizationsDelegates: const [
|
||||
SFLocalizations.delegate,
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
DefaultCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
],
|
||||
|
||||
supportedLocales: [for (final lang in supportedLanguages) Locale(lang)],
|
||||
localeResolutionCallback: (locale, supportedLocales) {
|
||||
if (locale == null) return supportedLocales.first;
|
||||
for (var supportedLocale in supportedLocales) {
|
||||
if (supportedLocale.languageCode == locale.languageCode) {
|
||||
return supportedLocale;
|
||||
}
|
||||
}
|
||||
return supportedLocales.first;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import 'package:auth/auth.dart';
|
||||
import 'package:dashboard_shell/dashboard_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:home/home.dart';
|
||||
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:notifications/notifications.dart';
|
||||
import 'package:profile/profile.dart';
|
||||
|
||||
@@ -16,34 +15,35 @@ late final GoRouter appRouter;
|
||||
void configureAppRouter() {
|
||||
appRouter = GoRouter(
|
||||
navigatorKey: rootNavigatorKey,
|
||||
initialLocation: '/login',
|
||||
// redirect: (context, state) {},
|
||||
initialLocation: AppRoutes.login,
|
||||
debugLogDiagnostics: true,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
path: AppRoutes.login,
|
||||
name: 'login',
|
||||
pageBuilder: LoginBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: '/onboarding',
|
||||
path: AppRoutes.onboarding,
|
||||
name: 'onboarding',
|
||||
pageBuilder: OnboardingBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: '/link_phone',
|
||||
path: AppRoutes.linkPhone,
|
||||
name: 'link_phone',
|
||||
pageBuilder: LinkPhoneBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: '/phone_code',
|
||||
path: AppRoutes.phoneCode,
|
||||
name: 'phone_code',
|
||||
pageBuilder: PhoneCodeBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: '/recover_password',
|
||||
path: AppRoutes.recoverPassword,
|
||||
name: 'recover_password',
|
||||
pageBuilder: RecoverPasswordBuilder().buildPage,
|
||||
),
|
||||
|
||||
StatefulShellRoute.indexedStack(
|
||||
builder: (context, state, navShell) {
|
||||
return DashboardBuilder().build(context, navShell);
|
||||
@@ -52,7 +52,7 @@ void configureAppRouter() {
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/main/home',
|
||||
path: AppRoutes.dashboardHome,
|
||||
name: 'home',
|
||||
pageBuilder: const HomeBuilder().buildPage,
|
||||
),
|
||||
@@ -61,7 +61,7 @@ void configureAppRouter() {
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/main/activity',
|
||||
path: AppRoutes.dashboardActivity,
|
||||
name: 'activity',
|
||||
pageBuilder: const ActivityBuilder().buildPage,
|
||||
),
|
||||
@@ -70,7 +70,7 @@ void configureAppRouter() {
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/main/notifications',
|
||||
path: AppRoutes.dashboardNotifications,
|
||||
name: 'notifications',
|
||||
pageBuilder: const NotificationsBuilder().buildPage,
|
||||
),
|
||||
@@ -79,7 +79,7 @@ void configureAppRouter() {
|
||||
StatefulShellBranch(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: '/main/profile',
|
||||
path: AppRoutes.dashboardProfile,
|
||||
name: 'profile',
|
||||
pageBuilder: const ProfileBuilder().buildPage,
|
||||
),
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
enum AppRoutes {
|
||||
onboarding,
|
||||
linkPhone,
|
||||
phoneCode,
|
||||
login,
|
||||
recoverPassword,
|
||||
home,
|
||||
activity,
|
||||
notifications,
|
||||
profile,
|
||||
}
|
||||
Reference in New Issue
Block a user