|
|
@@ -13,6 +13,8 @@ import 'package:telnow_mobile_new/src/utils/U.dart';
|
|
|
import 'package:telnow_mobile_new/src/utils/provider.dart';
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
|
+import '../../utils/C.dart';
|
|
|
+
|
|
|
class WebAccountPage extends StatefulWidget {
|
|
|
const WebAccountPage({super.key});
|
|
|
|
|
|
@@ -28,6 +30,7 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
bool dnd = false;
|
|
|
bool autoTranslate = false;
|
|
|
List lang = [];
|
|
|
+ var codeOflang = {};
|
|
|
bool _timeLimit = false;
|
|
|
|
|
|
@override
|
|
|
@@ -37,7 +40,7 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
accFunc.getUser(context);
|
|
|
setToggle();
|
|
|
checkPermission(0);
|
|
|
-
|
|
|
+print("load ulang akun web");
|
|
|
// TODO: implement initState
|
|
|
super.initState();
|
|
|
}
|
|
|
@@ -58,18 +61,27 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
dnd = Provider.of<UserModule>(context, listen: false).dndStatus();
|
|
|
serDis = U.servantDisplay();
|
|
|
autoTranslate = U.autoTranslate();
|
|
|
- lang = license['languages'] != null ? license['languages'].split(',') : [];
|
|
|
+ if(U.isCompatibleWith(VKey.multiBahasa)){
|
|
|
+ lang = license['_validLang'] ?? [];
|
|
|
+ } else {
|
|
|
+ lang = license['languages'] != null ? license['languages'].split(',') : [];
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- var codeOflang = {
|
|
|
+ codeOflang = {
|
|
|
"id": 'bahasa'.tr(),
|
|
|
"en": 'english'.tr(),
|
|
|
"ja": 'japanese'.tr(),
|
|
|
"zh": 'chinese'.tr(),
|
|
|
"ko": 'korean'.tr(),
|
|
|
+ "ar": 'arabic'.tr(),
|
|
|
+ "de": 'german'.tr(),
|
|
|
+ "fr": 'french'.tr(),
|
|
|
+ "hi": 'hindi'.tr(),
|
|
|
+ "nl": 'dutch'.tr()
|
|
|
};
|
|
|
return Provider.of<UserModule>(context).user().isNotEmpty ? Scaffold(
|
|
|
backgroundColor: backgroundColor,
|
|
|
@@ -267,7 +279,7 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
- onTap: ()=>changeLang(context, Provider.of<UserModule>(context, listen: false).user()),
|
|
|
+ onTap: () => changeLang(context, Provider.of<UserModule>(context, listen: false).user()),
|
|
|
),
|
|
|
divider(),
|
|
|
Container(
|
|
|
@@ -452,7 +464,7 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
changeLang(context, user) {
|
|
|
showDialog(
|
|
|
context: context,
|
|
|
- builder: (BuildContext context) {
|
|
|
+ builder: (BuildContext contextDialog) {
|
|
|
return AlertDialog(
|
|
|
contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
|
|
|
content: Column(
|
|
|
@@ -466,7 +478,7 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
),
|
|
|
divider(),
|
|
|
SizedBox(height: 16),
|
|
|
- listOfLang(user),
|
|
|
+ listOfLang(user, contextDialog),
|
|
|
SizedBox(height: 16)
|
|
|
],
|
|
|
),
|
|
|
@@ -475,46 +487,53 @@ class _WebAccountPageState extends State<WebAccountPage> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- listOfLang(user){
|
|
|
- return Column(
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- ListTile(
|
|
|
- title: Text('bahasa'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
- trailing: Icon(context.locale.toString()=='id'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
- onTap: context.locale.toString() != 'id' ? () async {
|
|
|
- accFunc.switchLang(context, 'id', user);
|
|
|
- } : null,
|
|
|
- ),
|
|
|
- ListTile(
|
|
|
- title: Text('english'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
- trailing: Icon(context.locale.toString()=='en'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
- onTap: context.locale.toString() != 'en' ? () async {
|
|
|
- accFunc.switchLang(context, 'en', user);
|
|
|
- } : null,
|
|
|
- ),
|
|
|
- lang.contains('ja') ? ListTile(
|
|
|
- title: Text('japanese'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
- trailing: Icon(context.locale.toString()=='ja'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
- onTap: context.locale.toString() != 'ja' ? () async {
|
|
|
- accFunc.switchLang(context, 'ja', user);
|
|
|
- } : null,
|
|
|
- ) : Container(),
|
|
|
- lang.contains('zh') ? ListTile(
|
|
|
- title: Text('chinese'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
- trailing: Icon(context.locale.toString()=='zh'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
- onTap: context.locale.toString() != 'zh' ? () async {
|
|
|
- accFunc.switchLang(context, 'zh', user);
|
|
|
- } : null,
|
|
|
- ) : Container(),
|
|
|
- lang.contains('ko') ? ListTile(
|
|
|
- title: Text('korean'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
- trailing: Icon(context.locale.toString()=='ko'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
- onTap: context.locale.toString() != 'ko' ? () async {
|
|
|
- accFunc.switchLang(context, 'ko', user);
|
|
|
- } : null,
|
|
|
- ) : Container()
|
|
|
- ],
|
|
|
+ listOfLang(user, cd){
|
|
|
+ return !mounted ? SizedBox() : SafeArea(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ ListTile(
|
|
|
+ title: Text('bahasa'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
+ trailing: Icon(context.locale.toString()=='id'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
+ onTap: context.locale.toString() != 'id' ? () async {
|
|
|
+ accFunc.switchLang(context, 'id', user);
|
|
|
+ Navigator.of(cd).pop();
|
|
|
+ } : null,
|
|
|
+ ),
|
|
|
+ ListTile(
|
|
|
+ title: Text('english'.tr(), style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
+ trailing: Icon(context.locale.toString()=='en'?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
+ onTap: context.locale.toString() != 'en' ? () async {
|
|
|
+ accFunc.switchLang(context, 'en', user);
|
|
|
+ Navigator.of(cd).pop();
|
|
|
+ } : null,
|
|
|
+ ),
|
|
|
+ lang.length - 1 > 1 ? ListTile(
|
|
|
+ title: Text(codeOflang[lang[2]], style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
+ trailing: Icon(context.locale.toString()==lang[2]?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
+ onTap: context.locale.toString() != lang[2] ? () async {
|
|
|
+ accFunc.switchLang(context, 1, user);
|
|
|
+ Navigator.of(cd).pop();
|
|
|
+ } : null,
|
|
|
+ ) : Container(),
|
|
|
+ lang.length - 1 > 2 ? ListTile(
|
|
|
+ title: Text(codeOflang[lang[3]], style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
+ trailing: Icon(context.locale.toString()==lang[3]?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
+ onTap: context.locale.toString() != lang[3] ? () async {
|
|
|
+ accFunc.switchLang(context, 2, user);
|
|
|
+ Navigator.of(cd).pop();
|
|
|
+ } : null,
|
|
|
+ ) : Container(),
|
|
|
+ lang.length - 1 > 3 ? ListTile(
|
|
|
+ title: Text(codeOflang[lang[4]], style: TextStyle(color: textColor, fontSize: 14)),
|
|
|
+ trailing: Icon(context.locale.toString()==lang[4]?Icons.radio_button_checked:Icons.radio_button_off, color: primaryColor, size: 18),
|
|
|
+ onTap: context.locale.toString() != lang[4] ? () async {
|
|
|
+ accFunc.switchLang(context, 3, user);
|
|
|
+ Navigator.of(cd).pop();
|
|
|
+ } : null,
|
|
|
+ ) : Container(),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
}
|