MINOR-FIX: Solve Localization Problem.
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -102,6 +102,8 @@ dependency_overrides:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user