Skip to content

Commit

Permalink
fix: fix applications text in SplashScreen page
Browse files Browse the repository at this point in the history
  • Loading branch information
esmaeil-ahmadipour committed Dec 13, 2024
1 parent 35758ba commit 679e57b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
47 changes: 23 additions & 24 deletions lib/src/core/utils/gen/localization/codegen_loader.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,34 @@ import 'dart:ui';

import 'package:easy_localization/easy_localization.dart' show AssetLoader;

class CodegenLoader extends AssetLoader {
class CodegenLoader extends AssetLoader{
const CodegenLoader();

@override
Future<Map<String, dynamic>?> load(String path, Locale locale) {
return Future.value(mapLocales[locale.toString()]);
}

static const Map<String, dynamic> en = {
"title": "Hello, World!",
"subtitle": "Welcome to Localization",
"description": "You have pushed the button this many times:",
"switchLanguage": "Switch language",
};
static const Map<String, dynamic> es = {
"title": "¡Hola, Mundo!",
"subtitle": "Bienvenido a Localización",
"description": "Has pulsado el botón tantas veces:",
"switchLanguage": "Cambiar idioma",
};
static const Map<String, dynamic> fr = {
"title": "Bonjour",
"subtitle": "Bienvenue dans Localisation",
"description": "Vous avez appuyé sur le bouton autant de fois :",
"switchLanguage": "Changer de langue",
};
static const Map<String, Map<String, dynamic>> mapLocales = {
"en": en,
"es": es,
"fr": fr,
};
static const Map<String,dynamic> fr = {
"title": "Bonjour",
"subtitle": "Bienvenue dans Localisation",
"description": "Vous avez appuyé sur le bouton autant de fois :",
"switchLanguage": "Changer de langue",
"applications": "Applications"
};
static const Map<String,dynamic> es = {
"title": "¡Hola, Mundo!",
"subtitle": "Bienvenido a Localización",
"description": "Has pulsado el botón tantas veces:",
"switchLanguage": "Cambiar idioma",
"applications": "Applications"
};
static const Map<String,dynamic> en = {
"title": "Hello, World!",
"subtitle": "Welcome to Localization",
"description": "You have pushed the button this many times:",
"switch_language": "Switch language",
"applications": "Applications"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"fr": fr, "es": es, "en": en};
}
4 changes: 3 additions & 1 deletion lib/src/core/utils/gen/localization/locale_keys.g.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// DO NOT EDIT. This is code generated via package:easy_localization/generate.dart

abstract class LocaleKeys {
abstract class LocaleKeys {
static const title = 'title';
static const subtitle = 'subtitle';
static const description = 'description';
static const switchLanguage = 'switchLanguage';
static const applications = 'applications';

}
11 changes: 6 additions & 5 deletions lib/src/features/splash/presentation/screen/splash_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:gap/gap.dart'; // Add this import
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:gui/src/core/common/colors/app_colors.dart';
import 'package:gui/src/core/router/route_name.dart';
import 'package:gui/src/core/utils/assets/assets.gen.dart';
import '../../../../core/common/colors/app_colors.dart';
import 'package:gui/src/core/utils/gen/assets/assets.gen.dart';
import 'package:gui/src/core/utils/gen/localization/locale_keys.g.dart';

class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
Expand Down Expand Up @@ -56,7 +57,7 @@ class _SplashScreenState extends State<SplashScreen> {
),
Gap(_spacingBetweenElements),
Text(
AppLocalizations.of(context)!.applications,
LocaleKeys.applications.tr(),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color: Colors.white,
),
Expand Down

0 comments on commit 679e57b

Please sign in to comment.