This commit is contained in:
Hamza-Ayed
2024-05-27 16:52:02 +03:00
parent 7a61ec2c78
commit b7dd057e12
4 changed files with 305 additions and 74 deletions

View File

@@ -32,9 +32,54 @@ class LocaleController extends GetxController {
appTheme = themeEnglish;
box.write(BoxName.lang, 'tr');
break;
case "fr":
locale = const Locale("fr");
appTheme = themeEnglish;
box.write(BoxName.lang, 'fr');
break;
case "it":
locale = const Locale("it");
appTheme = themeEnglish;
box.write(BoxName.lang, 'it');
break;
case "de":
locale = const Locale("de");
appTheme = themeEnglish;
box.write(BoxName.lang, 'de');
break;
case "el":
locale = const Locale("el");
appTheme = themeEnglish;
box.write(BoxName.lang, 'el');
break;
case "es":
locale = const Locale("es");
appTheme = themeEnglish;
box.write(BoxName.lang, 'es');
break;
case "fa":
locale = const Locale("fa");
appTheme = themeEnglish;
box.write(BoxName.lang, 'fa');
break;
case "zh":
locale = const Locale("zh");
appTheme = themeEnglish;
box.write(BoxName.lang, 'zh');
break;
case "ru":
locale = const Locale("ru");
appTheme = themeEnglish;
box.write(BoxName.lang, 'ru');
break;
case "hi":
locale = const Locale("hi");
appTheme = themeEnglish;
box.write(BoxName.lang, 'hi');
break;
default:
locale = Locale(Get.deviceLocale!.languageCode);
box.write(BoxName.lang, 'en');
box.write(BoxName.lang, Get.deviceLocale!.languageCode);
appTheme = themeEnglish;
break;
}
@@ -63,11 +108,48 @@ class LocaleController extends GetxController {
language = const Locale("tr");
appTheme = themeEnglish;
break;
case "fr":
language = const Locale("fr");
appTheme = themeEnglish;
break;
case "it":
language = const Locale("it");
appTheme = themeEnglish;
break;
case "de":
language = const Locale("de");
appTheme = themeEnglish;
break;
case "el":
language = const Locale("el");
appTheme = themeEnglish;
break;
case "es":
language = const Locale("es");
appTheme = themeEnglish;
break;
case "fa":
language = const Locale("fa");
appTheme = themeArabic;
break;
case "zh":
language = const Locale("zh");
appTheme = themeEnglish;
break;
case "ru":
language = const Locale("ru");
appTheme = themeEnglish;
break;
case "hi":
language = const Locale("hi");
appTheme = themeEnglish;
break;
default:
language = Locale(Get.deviceLocale!.languageCode);
appTheme = themeEnglish;
break;
}
super.onInit();
}
}

View File

@@ -1,10 +1,11 @@
import 'package:SEFER/constant/style.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import '../../constant/box_name.dart';
import '../../controller/local/local_controller.dart';
import '../../main.dart';
import '../auth/login_page.dart';
import '../home/map_page_passenger.dart';
@@ -18,8 +19,8 @@ class Language extends StatelessWidget {
builder: (controller) => Center(
child: Container(
padding: const EdgeInsets.all(15),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
child: ListView(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text(
"Choose Language".tr,
@@ -27,30 +28,218 @@ class Language extends StatelessWidget {
),
const SizedBox(height: 20),
MyElevatedButton(
title: 'Ar',
title: 'العربية',
onPressed: () {
controller.changeLang("ar");
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "En",
title: "English",
onPressed: () {
controller.changeLang("en");
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "Tr",
title: "Türkçe",
onPressed: () {
controller.changeLang("tr");
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "Français",
onPressed: () {
controller.changeLang("fr");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "Italiano",
onPressed: () {
controller.changeLang("it");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "Deutsch",
onPressed: () {
controller.changeLang("de");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.defaultDialog(
title:
'You should restart app to change language'
.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(
() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
}));
},
),
MyElevatedButton(
title: "Ελληνικά",
onPressed: () {
controller.changeLang("el");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "Español",
onPressed: () {
controller.changeLang("es");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "فارسی",
onPressed: () {
controller.changeLang("fa");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "中文",
onPressed: () {
controller.changeLang("zh");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "Русский",
onPressed: () {
controller.changeLang("ru");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
MyElevatedButton(
title: "हिन्दी",
onPressed: () {
controller.changeLang("hi");
Get.defaultDialog(
title: 'You should restart app to change language'.tr,
titleStyle: AppStyle.title,
middleText: '',
confirm: MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
box.read(BoxName.email) != null
? Get.offAll(() => const MapPagePassenger())
: Get.offAll(() => LoginPage());
}));
},
),
],

View File

@@ -41,14 +41,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.2.2"
archive:
dependency: transitive
description:
name: archive
sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b"
url: "https://pub.dev"
source: hosted
version: "3.4.9"
args:
dependency: transitive
description:
@@ -201,14 +193,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.7.4"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
url: "https://pub.dev"
source: hosted
version: "0.4.1"
clock:
dependency: transitive
description:
@@ -486,14 +470,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.7"
flutter_launcher_icons:
dependency: "direct main"
description:
name: flutter_launcher_icons
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted
version: "0.13.1"
flutter_lints:
dependency: "direct dev"
description:
@@ -944,14 +920,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
image:
dependency: transitive
description:
name: image
sha256: "028f61960d56f26414eb616b48b04eb37d700cbe477b7fb09bf1d7ce57fd9271"
url: "https://pub.dev"
source: hosted
version: "4.1.3"
image_cropper:
dependency: "direct main"
description:
@@ -1424,14 +1392,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.7"
pointycastle:
dependency: transitive
description:
name: pointycastle
sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c"
url: "https://pub.dev"
source: hosted
version: "3.7.3"
pool:
dependency: transitive
description:

View File

@@ -29,7 +29,7 @@ dependencies:
flutter_secure_storage: ^9.0.0
geolocator: ^10.0.0
flutter_paypal: ^0.2.0
flutter_launcher_icons: ^0.13.1
# flutter_launcher_icons: ^0.13.1
flutter_rating_bar: ^4.0.1
flutter_font_icons: ^2.2.5
image_picker: ^1.0.4
@@ -67,23 +67,23 @@ dev_dependencies:
envied_generator: ^0.5.2
build_runner: ^2.4.6
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/logo.png"
min_sdk_android: 21
web:
generate: true
image_path: "assets/images/logo.png"
background_color: "#hexcode"
theme_color: "#hexcode"
windows:
generate: true
image_path: "assets/images/logo.png"
icon_size: 48
macos:
generate: true
image_path: "assets/images/logo.png"
#flutter_launcher_icons:
# android: "launcher_icon"
# ios: true
# image_path: "assets/images/logo.png"
# min_sdk_android: 21
# web:
# generate: true
# image_path: "assets/images/logo.png"
# background_color: "#hexcode"
# theme_color: "#hexcode"
# windows:
# generate: true
# image_path: "assets/images/logo.png"
# icon_size: 48
# macos:
# generate: true
# image_path: "assets/images/logo.png"
flutter:
uses-material-design: true