fix:修复部分国际化bug
This commit is contained in:
parent
178353895e
commit
b79f5d0913
@ -1,6 +1,8 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@ -275,6 +277,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
return Container(
|
return Container(
|
||||||
width: 0.9.sw,
|
width: 0.9.sw,
|
||||||
height: 0.6.sw,
|
height: 0.6.sw,
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: 0.6.sw,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: const DecorationImage(
|
image: const DecorationImage(
|
||||||
image: AssetImage('images/xhj_main_bg.jpg'),
|
image: AssetImage('images/xhj_main_bg.jpg'),
|
||||||
@ -293,7 +298,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
const Spacer(),
|
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ShowTipView().showSureAlertDialog(
|
ShowTipView().showSureAlertDialog(
|
||||||
@ -322,9 +326,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
SizedBox(width: 20.w),
|
SizedBox(width: 20.w),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
|
||||||
height: 15.h,
|
|
||||||
),
|
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: state
|
visible: state
|
||||||
.keyInfos.value.lockFeature!.isSupportBackupBattery ==
|
.keyInfos.value.lockFeature!.isSupportBackupBattery ==
|
||||||
@ -388,7 +389,6 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
spreadRadius: 0,
|
spreadRadius: 0,
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
margin: EdgeInsets.only(top: 0.h),
|
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: AlignmentDirectional.center,
|
alignment: AlignmentDirectional.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -428,31 +428,17 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
Expanded(
|
||||||
Padding(
|
child: Text(
|
||||||
padding: EdgeInsets.only(left: 15.w, right: 00.w, bottom: 15.h),
|
'点击开锁,长按闭锁'.tr,
|
||||||
child: Row(
|
textAlign: TextAlign.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
style: TextStyle(
|
||||||
children: <Widget>[
|
color: AppColors.darkGrayTextColor,
|
||||||
Column(
|
fontSize: 20.sp,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
),
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'点击开锁,长按闭锁'.tr,
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.darkGrayTextColor,
|
|
||||||
fontSize: 20.sp,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 16.h,
|
|
||||||
),
|
|
||||||
adminInfoView(center: false, max: false),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
adminInfoView(center: false, max: false),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -762,90 +748,109 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
|
|
||||||
Widget adminInfoView(
|
Widget adminInfoView(
|
||||||
{bool center = true, bool max = true, bool add = false}) {
|
{bool center = true, bool max = true, bool add = false}) {
|
||||||
return Row(
|
return Expanded(
|
||||||
mainAxisAlignment:
|
child: Wrap(
|
||||||
center ? MainAxisAlignment.center : MainAxisAlignment.start,
|
children: <Widget>[
|
||||||
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
Row(
|
||||||
children: <Widget>[
|
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
||||||
Image.asset(
|
children: [
|
||||||
'images/icon_electronicKey_admin.png',
|
Image.asset(
|
||||||
width: 24.w,
|
'images/icon_electronicKey_admin.png',
|
||||||
height: 20.w,
|
width: 24.w,
|
||||||
color: AppColors.blackColor, //应根据状态显示(当前角色为超级管理员 应显示蓝色图标)
|
height: 20.w,
|
||||||
),
|
color: AppColors.blackColor, //应根据状态显示(当前角色为超级管理员 应显示蓝色图标)
|
||||||
SizedBox(width: 6.w),
|
),
|
||||||
Text(
|
SizedBox(width: 6.w),
|
||||||
state.keyInfos.value.isLockOwner == 1
|
Text(
|
||||||
? '超级管理员'.tr
|
state.keyInfos.value.isLockOwner == 1
|
||||||
: (state.keyInfos.value.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
|
? '超级管理员'.tr
|
||||||
style: TextStyle(fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
: (state.keyInfos.value.keyRight == 1
|
||||||
),
|
? '授权管理员'.tr
|
||||||
if (add) SizedBox(width: 20.w) else SizedBox(width: 40.w),
|
: '普通用户'.tr),
|
||||||
FlavorsImg(
|
style: TextStyle(
|
||||||
child: Image.asset(
|
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
||||||
state.keyInfos.value.hasGateway == 1
|
),
|
||||||
? 'images/main/icon_main_remoteUnlocking.png'
|
if (add) SizedBox(width: 20.w) else SizedBox(width: 40.w),
|
||||||
: 'images/main/icon_main_remoteUnlocking_grey.png',
|
],
|
||||||
width: 24.w,
|
|
||||||
height: 20.w,
|
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
SizedBox(width: 6.w),
|
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
||||||
Text(
|
children: [
|
||||||
'网关设备'.tr,
|
FlavorsImg(
|
||||||
style: TextStyle(
|
child: Image.asset(
|
||||||
fontSize: 20.sp,
|
state.keyInfos.value.hasGateway == 1
|
||||||
color: state.keyInfos.value.hasGateway == 1
|
? 'images/main/icon_main_remoteUnlocking.png'
|
||||||
? AppColors.mainColor
|
: 'images/main/icon_main_remoteUnlocking_grey.png',
|
||||||
: AppColors.btnDisableColor),
|
width: 24.w,
|
||||||
),
|
height: 20.w,
|
||||||
if (add) SizedBox(width: 20.w) else SizedBox(width: 20.w),
|
),
|
||||||
FlavorsImg(
|
),
|
||||||
child: Image.asset('images/main/icon_lockDetail_needNetwork.png',
|
SizedBox(width: 6.w),
|
||||||
width: 24.w,
|
Text(
|
||||||
height: 20.w,
|
'网关设备'.tr,
|
||||||
color: state.isOpenLockNeedOnline.value == 1
|
style: TextStyle(
|
||||||
? AppColors.mainColor
|
fontSize: 20.sp,
|
||||||
: AppColors.btnDisableColor),
|
color: state.keyInfos.value.hasGateway == 1
|
||||||
),
|
? AppColors.mainColor
|
||||||
SizedBox(width: 6.w),
|
: AppColors.btnDisableColor),
|
||||||
Text(
|
),
|
||||||
'手机需联网'.tr,
|
if (add) SizedBox(width: 20.w) else SizedBox(width: 20.w),
|
||||||
style: TextStyle(
|
],
|
||||||
fontSize: 20.sp,
|
),
|
||||||
color: state.isOpenLockNeedOnline.value == 1
|
Row(
|
||||||
? AppColors.mainColor
|
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
|
||||||
: AppColors.btnDisableColor),
|
children: [
|
||||||
),
|
FlavorsImg(
|
||||||
if (add) ...<Widget>[
|
child: Image.asset(
|
||||||
const Spacer(),
|
'images/main/icon_lockDetail_needNetwork.png',
|
||||||
GestureDetector(
|
width: 24.w,
|
||||||
onTap: () {
|
height: 20.w,
|
||||||
Get.toNamed(Routers.selectLockTypePage);
|
color: state.isOpenLockNeedOnline.value == 1
|
||||||
},
|
? AppColors.mainColor
|
||||||
child: Padding(
|
: AppColors.btnDisableColor),
|
||||||
padding: const EdgeInsets.all(8.0),
|
),
|
||||||
child: Row(
|
SizedBox(width: 6.w),
|
||||||
mainAxisSize: MainAxisSize.min,
|
Text(
|
||||||
children: <Widget>[
|
'手机需联网'.tr,
|
||||||
FlavorsImg(
|
style: TextStyle(
|
||||||
child: Image.asset(
|
fontSize: 20.sp,
|
||||||
'images/mine/icon_mine_main_addLock.png',
|
color: state.isOpenLockNeedOnline.value == 1
|
||||||
width: 24.w,
|
? AppColors.mainColor
|
||||||
height: 20.w,
|
: AppColors.btnDisableColor),
|
||||||
|
),
|
||||||
|
if (add) ...<Widget>[
|
||||||
|
const Spacer(),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.toNamed(Routers.selectLockTypePage);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
FlavorsImg(
|
||||||
|
child: Image.asset(
|
||||||
|
'images/mine/icon_mine_main_addLock.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 20.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'添加设备'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20.sp,
|
||||||
|
color: AppColors.darkGrayTextColor),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
),
|
||||||
'添加设备'.tr,
|
],
|
||||||
style: TextStyle(
|
],
|
||||||
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
@ -8,14 +7,14 @@ import 'messageList_entity.dart';
|
|||||||
import 'messageList_state.dart';
|
import 'messageList_state.dart';
|
||||||
|
|
||||||
typedef BlockDeletSuccssCallback = void Function();
|
typedef BlockDeletSuccssCallback = void Function();
|
||||||
|
|
||||||
class MessageListLogic extends BaseGetXController {
|
class MessageListLogic extends BaseGetXController {
|
||||||
final MessageListState state = MessageListState();
|
final MessageListState state = MessageListState();
|
||||||
|
|
||||||
//请求消息列表
|
//请求消息列表
|
||||||
Future<MessageListEntity> messageListDataRequest() async {
|
Future<MessageListEntity> messageListDataRequest() async {
|
||||||
final MessageListEntity entity = await ApiRepository.to.messageListLoadData(
|
final MessageListEntity entity = await ApiRepository.to
|
||||||
pageNo:pageNo.toString(),
|
.messageListLoadData(pageNo: pageNo.toString(), pageSize: pageSize);
|
||||||
pageSize:pageSize);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
if (pageNo == 1) {
|
||||||
state.itemDataList.value = entity.data!.list!;
|
state.itemDataList.value = entity.data!.list!;
|
||||||
@ -31,8 +30,10 @@ class MessageListLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 删除消息
|
// 删除消息
|
||||||
Future<void> deletMessageDataRequest(String messageId, BlockDeletSuccssCallback blockDeletSuccssCallback) async {
|
Future<void> deletMessageDataRequest(String messageId,
|
||||||
final MessageListEntity entity = await ApiRepository.to.deletMessageLoadData(messageId:messageId);
|
BlockDeletSuccssCallback blockDeletSuccssCallback) async {
|
||||||
|
final MessageListEntity entity =
|
||||||
|
await ApiRepository.to.deletMessageLoadData(messageId: messageId);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
blockDeletSuccssCallback();
|
blockDeletSuccssCallback();
|
||||||
}
|
}
|
||||||
@ -40,7 +41,8 @@ class MessageListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 清空消息
|
// 清空消息
|
||||||
Future<void> deletAllMessageDataRequest() async {
|
Future<void> deletAllMessageDataRequest() async {
|
||||||
final MessageListEntity entity = await ApiRepository.to.deletAllMessageLoadData();
|
final MessageListEntity entity =
|
||||||
|
await ApiRepository.to.deletAllMessageLoadData();
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
messageListDataRequest();
|
messageListDataRequest();
|
||||||
@ -49,9 +51,11 @@ class MessageListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 刷新消息列表
|
// 刷新消息列表
|
||||||
StreamSubscription? _readMessageRefreshUIEvent;
|
StreamSubscription? _readMessageRefreshUIEvent;
|
||||||
|
|
||||||
void _readMessageRefreshUIAction() {
|
void _readMessageRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_readMessageRefreshUIEvent = eventBus.on<ReadMessageRefreshUI>().listen((event) {
|
_readMessageRefreshUIEvent =
|
||||||
|
eventBus.on<ReadMessageRefreshUI>().listen((event) {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
messageListDataRequest();
|
messageListDataRequest();
|
||||||
});
|
});
|
||||||
@ -63,6 +67,14 @@ class MessageListLogic extends BaseGetXController {
|
|||||||
// messageListDataRequest();
|
// messageListDataRequest();
|
||||||
|
|
||||||
_readMessageRefreshUIAction();
|
_readMessageRefreshUIAction();
|
||||||
|
|
||||||
|
// 收到切换语言消息,重新拉取一下列表
|
||||||
|
eventBus
|
||||||
|
.on<ChangeLanguageBlockLastLanguageEvent>()
|
||||||
|
.listen((ChangeLanguageBlockLastLanguageEvent event) {
|
||||||
|
pageNo = 1;
|
||||||
|
messageListDataRequest();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -70,5 +82,4 @@ class MessageListLogic extends BaseGetXController {
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
_readMessageRefreshUIEvent?.cancel();
|
_readMessageRefreshUIEvent?.cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/mine/message/messageList/messageList_state.dart';
|
import 'package:star_lock/mine/message/messageList/messageList_state.dart';
|
||||||
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
@ -50,24 +50,26 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
? TitleAppBar(
|
? TitleAppBar(
|
||||||
barTitle: '消息'.tr,
|
barTitle: '消息'.tr,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
actionsList: <Widget>[
|
actionsList: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
child: Text(
|
child: Text(
|
||||||
'清空'.tr,
|
'清空'.tr,
|
||||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
final bool? isDemoMode =
|
||||||
if (isDemoMode == false) {
|
await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
ShowTipView().showIosTipWithContentDialog('是否清空?'.tr, () async {
|
if (isDemoMode == false) {
|
||||||
logic.deletAllMessageDataRequest();
|
ShowTipView().showIosTipWithContentDialog('是否清空?'.tr,
|
||||||
});
|
() async {
|
||||||
} else {
|
logic.deletAllMessageDataRequest();
|
||||||
logic.showToast('演示模式'.tr);
|
});
|
||||||
}
|
} else {
|
||||||
},
|
logic.showToast('演示模式'.tr);
|
||||||
),
|
}
|
||||||
],
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
backgroundColor: AppColors.mainColor)
|
backgroundColor: AppColors.mainColor)
|
||||||
: null,
|
: null,
|
||||||
body: EasyRefreshTool(onRefresh: () {
|
body: EasyRefreshTool(onRefresh: () {
|
||||||
@ -106,9 +108,10 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: _messageListItem(messageItemEntity, () {
|
child: _messageListItem(messageItemEntity, () {
|
||||||
Get.toNamed(Routers.messageDetailPage, arguments: <String, MessageItemEntity>{
|
Get.toNamed(Routers.messageDetailPage,
|
||||||
'messageItemEntity': messageItemEntity
|
arguments: <String, MessageItemEntity>{
|
||||||
});
|
'messageItemEntity': messageItemEntity
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
@ -137,15 +140,21 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (messageItemEntity.readAt! == 0) Container(
|
if (messageItemEntity.readAt! == 0)
|
||||||
width: 10.w,
|
Container(
|
||||||
height: 10.w,
|
width: 10.w,
|
||||||
decoration: BoxDecoration(
|
height: 10.w,
|
||||||
color: Colors.red,
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
color: Colors.red,
|
||||||
),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
) else Container(),
|
),
|
||||||
if (messageItemEntity.readAt! == 0) SizedBox(width: 5.w) else Container(),
|
)
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
|
if (messageItemEntity.readAt! == 0)
|
||||||
|
SizedBox(width: 5.w)
|
||||||
|
else
|
||||||
|
Container(),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
messageItemEntity.data!,
|
messageItemEntity.data!,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
import 'package:star_lock/app_settings/app_settings.dart';
|
||||||
@ -16,16 +15,18 @@ class MineMultiLanguageLogic extends GetxController {
|
|||||||
// AppLog.log('lanTypeTitle: $lanTypeTitle');
|
// AppLog.log('lanTypeTitle: $lanTypeTitle');
|
||||||
|
|
||||||
final String lang = l.toLanguageTag();
|
final String lang = l.toLanguageTag();
|
||||||
final PasswordKeyListEntity entity = await ApiRepository.to.updateUserLangInfo(lang: lang);
|
final PasswordKeyListEntity entity =
|
||||||
|
await ApiRepository.to.updateUserLangInfo(lang: lang);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
await changeLanguage(l);
|
await changeLanguage(l);
|
||||||
eventBus.fire(ChangeLanguageBlockLastLanguageEvent());
|
eventBus.fire(ChangeLanguageBlockLastLanguageEvent());
|
||||||
|
print('发送语言变化事件');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> changeLanguage(Locale l) async {
|
Future<void> changeLanguage(Locale l) async {
|
||||||
if(l == Get.locale)return;
|
if (l == Get.locale) return;
|
||||||
await Get.updateLocale(l);
|
await Get.updateLocale(l);
|
||||||
state.resetLan();
|
state.resetLan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -25,6 +24,7 @@ import '../../../translations/app_dept.dart';
|
|||||||
|
|
||||||
class MineSetLogic extends BaseGetXController {
|
class MineSetLogic extends BaseGetXController {
|
||||||
final MineSetState state = MineSetState();
|
final MineSetState state = MineSetState();
|
||||||
|
|
||||||
//用户信息
|
//用户信息
|
||||||
Future<void> userSettingsInfoRequest() async {
|
Future<void> userSettingsInfoRequest() async {
|
||||||
final UserSettingInfoEntity entity =
|
final UserSettingInfoEntity entity =
|
||||||
@ -108,7 +108,8 @@ class MineSetLogic extends BaseGetXController {
|
|||||||
getPushDeviceID = value;
|
getPushDeviceID = value;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
final LoginEntity entity = await ApiRepository.to.userLogout(deviceld: getPushDeviceID);
|
final LoginEntity entity =
|
||||||
|
await ApiRepository.to.userLogout(deviceld: getPushDeviceID);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
UdpHelp().closeUDP();
|
UdpHelp().closeUDP();
|
||||||
logOut();
|
logOut();
|
||||||
@ -148,10 +149,14 @@ class MineSetLogic extends BaseGetXController {
|
|||||||
|
|
||||||
String _getCurrentLanguage() {
|
String _getCurrentLanguage() {
|
||||||
String? languageCode = StoreService.to.getLanguageCode();
|
String? languageCode = StoreService.to.getLanguageCode();
|
||||||
if(languageCode!.isEmpty){
|
if (languageCode!.isEmpty) {
|
||||||
languageCode = Get.deviceLocale!.languageCode;
|
languageCode = Get.deviceLocale!.languageCode;
|
||||||
}
|
}
|
||||||
final String currentLanguage = ExtensionLanguageType.fromLocale(appDept.deptSupportedLocales.where((Locale element) => element.languageCode == languageCode).first).lanTitle;
|
final String currentLanguage = ExtensionLanguageType.fromLocale(appDept
|
||||||
|
.deptSupportedLocales
|
||||||
|
.where((Locale element) => element.languageCode == languageCode)
|
||||||
|
.first)
|
||||||
|
.lanTitle;
|
||||||
return currentLanguage;
|
return currentLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,4 +10,7 @@ class LanguageTool {
|
|||||||
String get currentLanguage => Get.locale?.languageCode ?? 'zh';
|
String get currentLanguage => Get.locale?.languageCode ?? 'zh';
|
||||||
|
|
||||||
bool get isChinese => currentLanguage == 'zh';
|
bool get isChinese => currentLanguage == 'zh';
|
||||||
|
|
||||||
|
bool get isArabic => currentLanguage == 'ar';
|
||||||
|
bool get isHebrew => currentLanguage == 'he';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
|
import 'package:star_lock/tools/langue/langue_tool.dart';
|
||||||
|
|
||||||
class TitleAppBar extends AppBar {
|
class TitleAppBar extends AppBar {
|
||||||
@override
|
@override
|
||||||
@ -40,13 +41,17 @@ class TitleAppBar extends AppBar {
|
|||||||
class _TitleAppBarState extends State<TitleAppBar> {
|
class _TitleAppBarState extends State<TitleAppBar> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
bool isRTL =
|
||||||
|
LanguageTool.instance.isArabic || LanguageTool.instance.isHebrew;
|
||||||
|
|
||||||
return AppBar(
|
return AppBar(
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
leading: widget.haveOtherLeftWidget!
|
leading: widget.haveOtherLeftWidget!
|
||||||
? widget.leftWidget
|
? widget.leftWidget
|
||||||
: (widget.haveBack ?? false
|
: (widget.haveBack ?? false
|
||||||
? IconButton(
|
? IconButton(
|
||||||
icon: Icon(Icons.arrow_back_ios,
|
icon: Icon(
|
||||||
|
isRTL ? Icons.arrow_forward_ios : Icons.arrow_back_ios,
|
||||||
color: widget.iconColor ?? Colors.white),
|
color: widget.iconColor ?? Colors.white),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (widget.backAction != null) {
|
if (widget.backAction != null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user