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

@@ -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());
}));
},
),
],