MINOR-FIX: Solve Localization Problem.

This commit is contained in:
2025-12-04 17:18:43 +05:00
parent bf1d07a048
commit 50270ed2da
4 changed files with 49 additions and 47 deletions

View File

@@ -13,6 +13,7 @@ import 'package:get/get.dart';
import 'controllers/global_setting_controller.dart';
import 'controllers/theme_controller.dart';
import 'firebase_options.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@@ -45,10 +46,16 @@ class MyApp extends StatelessWidget {
splitScreenMode: true,
child: GetMaterialApp(
translations: LocalizationService(),
locale: const Locale('uz', 'UZ'),
navigatorKey: AppRouter.navigatorKey,
fallbackLocale: const Locale('uz', 'UZ'),
locale: const Locale('uz', 'UZ'), // current locale
fallbackLocale: const Locale('en', 'US'),
supportedLocales: LocalizationService.supportedLocales,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
navigatorKey: AppRouter.navigatorKey,
debugShowCheckedModeBanner: false,
builder: (context, child) {
return SafeArea(

View File

@@ -1,3 +1,4 @@
import 'package:customer/constant/const_texts.dart';
import 'package:customer/constant/constant.dart';
import 'package:customer/controllers/change_language_controller.dart';
import 'package:customer/screen_ui/splash_screen/splash_screen.dart';
@@ -27,17 +28,6 @@ class ChangeLanguageScreen extends StatelessWidget {
isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
centerTitle: false,
titleSpacing: 0,
leading: InkWell(
onTap: () {
// Get.back();
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => SplashScreen()),
(route) => false,
);
},
child: Icon(Icons.arrow_back),
),
),
body:
controller.isLoading.value
@@ -45,38 +35,41 @@ class ChangeLanguageScreen extends StatelessWidget {
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 16),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// ConstTexts.changeLanguage.tr,
// style: TextStyle(
// fontSize: 24,
// color:
// isDark
// ? AppThemeData.grey50
// : AppThemeData.grey900,
// fontFamily: AppThemeData.semiBold,
// fontWeight: FontWeight.w500,
// ),
// ),
// Text(
// ConstTexts.selectPrefferedLanguage.tr,
// style: TextStyle(
// fontSize: 16,
// color:
// isDark
// ? AppThemeData.grey50
// : AppThemeData.grey900,
// fontFamily: AppThemeData.regular,
// fontWeight: FontWeight.w400,
// ),
// ),
// ],
// ),
// ),
SizedBox(
height: 100.h,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
ConstTexts.changeLanguage.tr,
style: TextStyle(
fontSize: 24,
color:
isDark
? AppThemeData.grey50
: AppThemeData.grey900,
fontFamily: AppThemeData.semiBold,
fontWeight: FontWeight.w500,
),
),
Text(
ConstTexts.selectPrefferedLanguage.tr,
style: TextStyle(
fontSize: 16,
color:
isDark
? AppThemeData.grey50
: AppThemeData.grey900,
fontFamily: AppThemeData.regular,
fontWeight: FontWeight.w400,
),
),
],
),
),
),
_buildLanguageButton(
isActive: Get.locale == const Locale("uz", "UZ"),
flagCode: FlagsCode.UZ,

View File

@@ -647,7 +647,7 @@ packages:
source: hosted
version: "0.3.3"
flutter_localizations:
dependency: transitive
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"

View File

@@ -102,6 +102,8 @@ dependency_overrides:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_localizations:
sdk: flutter
flutter_lints: ^6.0.0