fix marker rendering & modernize riding widgets for dark mode - 2026-04-11
This commit is contained in:
@@ -9,96 +9,46 @@ class LocaleController extends GetxController {
|
||||
Locale? language;
|
||||
String countryCode = '';
|
||||
|
||||
ThemeData appTheme = lightThemeEnglish;
|
||||
ThemeMode themeMode = ThemeMode.system;
|
||||
|
||||
void changeLang(String langcode) {
|
||||
Locale locale;
|
||||
switch (langcode) {
|
||||
case "ar":
|
||||
locale = const Locale("ar");
|
||||
appTheme = lightThemeArabic;
|
||||
box.write(BoxName.lang, 'ar');
|
||||
break;
|
||||
case "ar-main":
|
||||
locale = const Locale("ar-main");
|
||||
appTheme = lightThemeArabic;
|
||||
box.write(BoxName.lang, 'ar-main');
|
||||
break;
|
||||
case "en":
|
||||
locale = const Locale("en");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'en');
|
||||
break;
|
||||
case "tr":
|
||||
locale = const Locale("tr");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'tr');
|
||||
break;
|
||||
case "fr":
|
||||
locale = const Locale("fr");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'fr');
|
||||
break;
|
||||
case "it":
|
||||
locale = const Locale("it");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'it');
|
||||
break;
|
||||
case "de":
|
||||
locale = const Locale("de");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'de');
|
||||
break;
|
||||
case "el":
|
||||
locale = const Locale("el");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'el');
|
||||
break;
|
||||
case "es":
|
||||
locale = const Locale("es");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'es');
|
||||
break;
|
||||
case "fa":
|
||||
locale = const Locale("fa");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'fa');
|
||||
break;
|
||||
case "zh":
|
||||
locale = const Locale("zh");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'zh');
|
||||
break;
|
||||
case "ru":
|
||||
locale = const Locale("ru");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'ru');
|
||||
break;
|
||||
case "hi":
|
||||
locale = const Locale("hi");
|
||||
appTheme = lightThemeEnglish;
|
||||
box.write(BoxName.lang, 'hi');
|
||||
break;
|
||||
case "ar-ma":
|
||||
locale = const Locale("ar-ma");
|
||||
appTheme = lightThemeArabic;
|
||||
box.write(BoxName.lang, 'ar-ma');
|
||||
break;
|
||||
case "ar-gulf":
|
||||
locale = const Locale("ar-gulf");
|
||||
appTheme = lightThemeArabic;
|
||||
box.write(BoxName.lang, 'ar-gulf');
|
||||
break;
|
||||
default:
|
||||
locale = Locale(Get.deviceLocale!.languageCode);
|
||||
box.write(BoxName.lang, Get.deviceLocale!.languageCode);
|
||||
appTheme = lightThemeEnglish;
|
||||
break;
|
||||
Locale newLocale;
|
||||
ThemeData newTheme;
|
||||
bool isArabic = langcode.startsWith('ar');
|
||||
|
||||
if (isArabic) {
|
||||
newLocale = const Locale("ar");
|
||||
newTheme = Get.isDarkMode ? darkThemeArabic : lightThemeArabic;
|
||||
} else {
|
||||
newLocale = const Locale("en");
|
||||
newTheme = Get.isDarkMode ? darkThemeEnglish : lightThemeEnglish;
|
||||
}
|
||||
|
||||
box.write(BoxName.lang, langcode);
|
||||
Get.changeTheme(appTheme);
|
||||
Get.updateLocale(locale);
|
||||
language = newLocale;
|
||||
Get.changeTheme(newTheme);
|
||||
Get.updateLocale(newLocale);
|
||||
update();
|
||||
}
|
||||
|
||||
void changeThemeMode(ThemeMode mode) {
|
||||
themeMode = mode;
|
||||
Get.changeThemeMode(mode);
|
||||
|
||||
// Explicitly update ThemeData to ensure immediate font and color changes
|
||||
bool goDark = mode == ThemeMode.dark ||
|
||||
(mode == ThemeMode.system && Get.isPlatformDarkMode);
|
||||
bool isArabic = (language?.languageCode ?? 'en').startsWith('ar');
|
||||
|
||||
ThemeData newTheme;
|
||||
if (isArabic) {
|
||||
newTheme = goDark ? darkThemeArabic : lightThemeArabic;
|
||||
} else {
|
||||
newTheme = goDark ? darkThemeEnglish : lightThemeEnglish;
|
||||
}
|
||||
Get.changeTheme(newTheme);
|
||||
|
||||
box.write(BoxName.themeMode, mode.toString());
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -111,95 +61,18 @@ class LocaleController extends GetxController {
|
||||
box.write(BoxName.lang, storedLang);
|
||||
}
|
||||
|
||||
String? storedTheme = box.read(BoxName.themeMode);
|
||||
if (storedTheme != null) {
|
||||
if (storedTheme == ThemeMode.light.toString()) {
|
||||
themeMode = ThemeMode.light;
|
||||
} else if (storedTheme == ThemeMode.dark.toString()) {
|
||||
themeMode = ThemeMode.dark;
|
||||
} else {
|
||||
themeMode = ThemeMode.system;
|
||||
}
|
||||
}
|
||||
|
||||
changeLang(storedLang);
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
// class LocaleController extends GetxController {
|
||||
// Locale? language;
|
||||
// String countryCode = '';
|
||||
// void restartApp() {
|
||||
// runApp(const MyApp());
|
||||
// }
|
||||
|
||||
// ThemeData appTheme = themeEnglish;
|
||||
|
||||
// changeLang(String langcode) {
|
||||
// Locale locale;
|
||||
// switch (langcode) {
|
||||
// case "ar":
|
||||
// locale = const Locale("ar");
|
||||
// appTheme = themeArabic;
|
||||
// break;
|
||||
// case "en":
|
||||
// locale = const Locale("en");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "tr":
|
||||
// locale = const Locale("tr");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "fr":
|
||||
// locale = const Locale("fr");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "it":
|
||||
// locale = const Locale("it");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "de":
|
||||
// locale = const Locale("de");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "el":
|
||||
// locale = const Locale("el");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "es":
|
||||
// locale = const Locale("es");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "fa":
|
||||
// locale = const Locale("fa");
|
||||
// appTheme = themeArabic;
|
||||
// break;
|
||||
// case "zh":
|
||||
// locale = const Locale("zh");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "ru":
|
||||
// locale = const Locale("ru");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// case "hi":
|
||||
// locale = const Locale("hi");
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// default:
|
||||
// locale = Locale(Get.deviceLocale!.languageCode);
|
||||
// appTheme = themeEnglish;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// box.write(BoxName.lang, langcode);
|
||||
// Get.changeTheme(appTheme);
|
||||
// Get.updateLocale(locale);
|
||||
// restartApp();
|
||||
// update();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void onInit() {
|
||||
// String? storedLang = box.read(BoxName.lang);
|
||||
// if (storedLang == null) {
|
||||
// // Use device language if no language is stored
|
||||
// storedLang = Get.deviceLocale!.languageCode;
|
||||
// box.write(BoxName.lang, storedLang);
|
||||
// }
|
||||
|
||||
// changeLang(storedLang);
|
||||
|
||||
// super.onInit();
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
library intl_phone_field;
|
||||
|
||||
import 'package:Intaleq/print.dart';
|
||||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -77,7 +78,7 @@ class IntlPhoneField extends StatefulWidget {
|
||||
/// to the [focusNode]:
|
||||
///
|
||||
/// ```dart
|
||||
/// focusNode.addListener(() { print(myFocusNode.hasFocus); });
|
||||
/// focusNode.addListener(() { Log.print(myFocusNode.hasFocus); });
|
||||
/// ```
|
||||
///
|
||||
/// If null, this widget will create its own [FocusNode].
|
||||
@@ -518,4 +519,4 @@ class _IntlPhoneFieldState extends State<IntlPhoneField> {
|
||||
enum IconPosition {
|
||||
leading,
|
||||
trailing,
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user