fix: 修复国际化bug

This commit is contained in:
魏少阳 2024-11-20 10:04:55 +08:00
parent 720406913a
commit 652a46aa3e
10 changed files with 221 additions and 149 deletions

View File

@ -16,7 +16,7 @@
"添加者": "Αερομεταφορέας",
"添加时间": "Χρόνο",
"重置": "Επαναφοράς",
"请输入手机号或者邮箱": "Αριθμός τηλεφώνου ή email",
"请输入手机号或者邮箱": "Tηλεφώνο/email",
"工作时间": "Χρόνος εργασίας",
"工作日设置": "Ρύθμιση ημέρας εργασίας",
"星期一": "Δευτέρα.",

View File

@ -16,7 +16,7 @@
"添加者": "Opérateur",
"添加时间": "Temps",
"重置": "Réinitialiser",
"请输入手机号或者邮箱": "Numéro de téléphone ou courriel",
"请输入手机号或者邮箱": "Tel/E-mail",
"工作时间": "Temps de travail",
"工作日设置": "Réglage de Workday",
"星期一": "Lundi",

View File

@ -171,5 +171,3 @@ Future<void> getAgreePrivacyShowUpdate() async {
AppFirstEnterHandle().getAppFirstEnter(isShowUpdateVersion);
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -63,9 +62,9 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
automaticIndicatorColorAdjustment: true,
labelColor: AppColors.mainColor,
labelStyle: TextStyle(
color: AppColors.mainColor,
fontSize: 24.sp,
fontWeight: FontWeight.w600),
color: AppColors.mainColor,
fontSize: 24.sp,
),
indicator: CustomUnderlineTabIndicator(
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
strokeCap: StrokeCap.round,

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -69,25 +68,24 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
height: 30.h,
),
Obx(() => GestureDetector(
onTap: (){
if(state.canResend.value){
logic.sendValidationCode();
}
},
child: Container(
padding: EdgeInsets.only(left:20.w, right: 20.w, top: 10.h, bottom: 10.h),
onTap: () {
if (state.canResend.value) {
logic.sendValidationCode();
}
},
child: Container(
padding: EdgeInsets.only(
left: 20.w, right: 20.w, top: 10.h, bottom: 10.h),
// height: 60.h,
width: 200.w,
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(10.h),
// borderRadius: BorderRadius.circular(30.w)
borderRadius: BorderRadius.circular(10.h),
// borderRadius: BorderRadius.circular(30.w)
),
child:Text(state.btnText.value,
child: Text(state.btnText.value,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 22.sp)),
style: TextStyle(color: Colors.white, fontSize: 22.sp)),
// SubmitBtn(
// btnName: state.btnText.value,
// onClick: state.canResend.value ? () {
@ -95,7 +93,7 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
// } : null,
// ),
),
)),
)),
SizedBox(
height: 60.h,
),
@ -103,46 +101,45 @@ class _SafeVerifyPageState extends State<SafeVerifyPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Obx(() => Padding(
padding: EdgeInsets.only(left: 60.w, right: 60.w),
child: Text(
'${'请点击获取验证码,验证码将发送到'.tr}${state.accountStr.value}',
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
),
)),
padding: EdgeInsets.only(left: 60.w, right: 60.w),
child: Text(
'${'请点击获取验证码,验证码将发送到'.tr}${state.accountStr.value}',
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 22.sp),
),
)),
SizedBox(height: 10.h),
Obx(() => Visibility(
visible: state.isToggle.value,
child: GestureDetector(
onTap: (){
if(state.channel.value == '1'){
//
state.channel.value = '2';
state.accountStr.value = state.loginData.value.email!;
}else{
//
state.channel.value = '1';
state.accountStr.value = state.loginData.value.mobile!;
}
},
child: Container(
margin: EdgeInsets.only(left: 60.w, right: 60.w),
padding: EdgeInsets.only(left:10.w, right: 10.w, top: 5.h, bottom: 5.h),
// height: 60.h,
width: 100.w,
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(10.h),
// borderRadius: BorderRadius.circular(30.w)
visible: state.isToggle.value,
child: GestureDetector(
onTap: () {
if (state.channel.value == '1') {
//
state.channel.value = '2';
state.accountStr.value = state.loginData.value.email!;
} else {
//
state.channel.value = '1';
state.accountStr.value = state.loginData.value.mobile!;
}
},
child: Container(
margin: EdgeInsets.only(left: 60.w, right: 60.w),
padding: EdgeInsets.all(10.w),
// height: 60.h,
// width: 100.w,
decoration: BoxDecoration(
color: AppColors.mainColor,
borderRadius: BorderRadius.circular(10.h),
// borderRadius: BorderRadius.circular(30.w)
),
child: Text('切换'.tr,
textAlign: TextAlign.center,
style:
TextStyle(color: Colors.white, fontSize: 22.sp)),
),
),
child:Text('切换'.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 22.sp)),
),
),
)),
)),
],
),
SizedBox(

View File

@ -1,8 +1,8 @@
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
@ -296,10 +296,9 @@ class _MineSetPageState extends State<MineSetPage>
})),
*/
Obx(() => CommonItem(
leftTitel:'隐藏无效开锁权限'.tr,
rightTitle: (state.hideExpiredAccessFlag.value == 1
? '已开启'.tr
: '已关闭'.tr),
leftTitel: '隐藏无效开锁权限'.tr,
rightTitle:
(state.hideExpiredAccessFlag.value == 1 ? '已开启'.tr : '已关闭'.tr),
isHaveLine: true,
isHaveDirection: true,
action: () {
@ -311,12 +310,9 @@ class _MineSetPageState extends State<MineSetPage>
logic.userSettingsInfoRequest();
});
})),
CommonItem(
leftTitel: 'APP开锁时需手机连网的锁'.tr,
rightTitle: '',
// allHeight: 100.h,
otherItem(
leftTitle: 'APP开锁时需手机连网的锁'.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.aPPUnlockNeedMobileNetworkingLockPage);
@ -366,7 +362,7 @@ class _MineSetPageState extends State<MineSetPage>
leftTitel: '客服'.tr,
isHaveLine: widget.showAbout,
isHaveDirection: true,
action: (){
action: () {
WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
},
),
@ -458,6 +454,45 @@ class _MineSetPageState extends State<MineSetPage>
);
}
Widget otherItem(
{String? leftTitle,
bool? isHaveLine,
Function()? action,
double? allHeight}) {
return GestureDetector(
onTap: action,
child: Container(
width: 1.sw,
padding:
EdgeInsets.only(left: 20.w, top: 15.h, bottom: 15.h, right: 10.w),
decoration: BoxDecoration(
color: Colors.white,
border: isHaveLine!
? Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
: null,
),
child: Row(
children: <Widget>[
Expanded(
child: Text(leftTitle!, style: TextStyle(fontSize: 22.sp))),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',
width: 12.w,
height: 21.w,
),
SizedBox(width: 5.w),
],
),
),
);
}
//
// void _showDialog(widgetContext) {
// showCupertinoDialog(

View File

@ -97,14 +97,14 @@ class AddressPickerRoute<T> extends PopupRoute<T> {
}
class _PickerContentView extends StatefulWidget {
_PickerContentView({
Key? key,
const _PickerContentView({
required this.initProvince,
required this.initCity,
this.initTown,
required this.pickerStyle,
required this.addAllItem,
required this.route,
Key? key,
this.initTown,
}) : super(key: key);
final String initProvince, initCity;
@ -114,17 +114,17 @@ class _PickerContentView extends StatefulWidget {
final PickerStyle pickerStyle;
@override
State<StatefulWidget> createState() => _PickerState(this.initProvince,
this.initCity, this.initTown, this.addAllItem, this.pickerStyle);
State<StatefulWidget> createState() =>
_PickerState(initProvince, initCity, initTown, addAllItem, pickerStyle);
}
class _PickerState extends State<_PickerContentView> {
final PickerStyle _pickerStyle;
late String _currentProvince, _currentCity;
String? _currentTown;
var cities = [];
var towns = [];
var provinces = [];
List cities = [];
List towns = [];
List provinces = [];
//
bool hasTown = true;
@ -142,7 +142,7 @@ class _PickerState extends State<_PickerContentView> {
_PickerState(this._currentProvince, this._currentCity, this._currentTown,
this.addAllItem, this._pickerStyle) {
provinces = Address.provinces;
hasTown = this._currentTown != null;
hasTown = _currentTown != null;
_init();
}
@ -165,7 +165,7 @@ class _PickerState extends State<_PickerContentView> {
return ClipRect(
child: CustomSingleChildLayout(
delegate: _BottomPickerLayout(
widget.route.animation!.value, this._pickerStyle),
widget.route.animation!.value, _pickerStyle),
child: GestureDetector(
child: Material(
color: Colors.transparent,
@ -186,7 +186,7 @@ class _PickerState extends State<_PickerContentView> {
int tindex = 0;
pindex = provinces.indexWhere((p) => p == _currentProvince);
pindex = pindex >= 0 ? pindex : 0;
String? selectedProvince = provinces[pindex];
final String? selectedProvince = provinces[pindex];
if (selectedProvince != null) {
_currentProvince = selectedProvince;
@ -202,7 +202,7 @@ class _PickerState extends State<_PickerContentView> {
towns = Address.getTowns(cities[cindex]['cityCode']);
tindex = towns.indexWhere((t) => t == _currentTown);
tindex = tindex >= 0 ? tindex : 0;
if (towns.length == 0) {
if (towns.isEmpty) {
_currentTown = '';
} else {
_currentTown = towns[tindex];
@ -210,13 +210,13 @@ class _PickerState extends State<_PickerContentView> {
}
}
provinceScrollCtrl = new FixedExtentScrollController(initialItem: pindex);
cityScrollCtrl = new FixedExtentScrollController(initialItem: cindex);
townScrollCtrl = new FixedExtentScrollController(initialItem: tindex);
provinceScrollCtrl = FixedExtentScrollController(initialItem: pindex);
cityScrollCtrl = FixedExtentScrollController(initialItem: cindex);
townScrollCtrl = FixedExtentScrollController(initialItem: tindex);
}
void _setProvince(int index) {
String selectedProvince = provinces[index];
final String selectedProvince = provinces[index];
// AppLog.log('longer >>> index:$index _currentProvince:$_currentProvince selectedProvince:$selectedProvince ');
if (_currentProvince != selectedProvince) {
@ -241,7 +241,7 @@ class _PickerState extends State<_PickerContentView> {
void _setCity(int index) {
index = cities.length > index ? index : 0;
String selectedCity = cities[index]['name'];
final String selectedCity = cities[index]['name'];
if (_currentCity != selectedCity) {
setState(() {
_currentCity = selectedCity;
@ -258,7 +258,7 @@ class _PickerState extends State<_PickerContentView> {
void _setTown(int index) {
index = towns.length > index ? index : 0;
String selectedTown = towns[index];
final String selectedTown = towns[index];
if (_currentTown != selectedTown) {
_currentTown = selectedTown;
_notifyLocationChanged();
@ -272,7 +272,7 @@ class _PickerState extends State<_PickerContentView> {
}
double _pickerFontSize(String text) {
double ratio = hasTown ? 0.0 : 2.0;
final double ratio = hasTown ? 0.0 : 2.0;
if (text.length <= 6) {
return 18.0;
} else if (text.length < 9) {
@ -285,12 +285,12 @@ class _PickerState extends State<_PickerContentView> {
}
Widget _renderPickerView() {
Widget itemView = _renderItemView();
final Widget itemView = _renderItemView();
if (!_pickerStyle.showTitleBar && _pickerStyle.menu == null) {
return itemView;
}
List<Widget> viewList = <Widget>[];
final List<Widget> viewList = <Widget>[];
if (_pickerStyle.showTitleBar) {
viewList.add(_titleView());
}
@ -315,12 +315,10 @@ class _PickerState extends State<_PickerContentView> {
scrollController: provinceScrollCtrl,
selectionOverlay: _pickerStyle.itemOverlay,
itemExtent: _pickerStyle.pickerItemHeight,
onSelectedItemChanged: (int index) {
_setProvince(index);
},
onSelectedItemChanged: _setProvince,
childCount: Address.provinces.length,
itemBuilder: (_, index) {
String text = Address.provinces[index];
itemBuilder: (_, int index) {
final String text = Address.provinces[index];
return Align(
alignment: Alignment.center,
child: Text(text,
@ -336,20 +334,18 @@ class _PickerState extends State<_PickerContentView> {
),
Expanded(
child: Container(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: CupertinoPicker.builder(
scrollController: cityScrollCtrl,
selectionOverlay: _pickerStyle.itemOverlay,
itemExtent: _pickerStyle.pickerItemHeight,
onSelectedItemChanged: (int index) {
_setCity(index);
},
onSelectedItemChanged: _setCity,
childCount: cities.length,
itemBuilder: (_, index) {
String text = cities[index]['name'];
itemBuilder: (_, int index) {
final String text = cities[index]['name'];
return Align(
alignment: Alignment.center,
child: Text('$text',
child: Text(text,
style: TextStyle(
color: _pickerStyle.textColor,
fontSize:
@ -360,34 +356,33 @@ class _PickerState extends State<_PickerContentView> {
},
)),
),
hasTown
? Expanded(
child: Container(
padding: EdgeInsets.all(8.0),
child: CupertinoPicker.builder(
scrollController: townScrollCtrl,
selectionOverlay: _pickerStyle.itemOverlay,
itemExtent: _pickerStyle.pickerItemHeight,
onSelectedItemChanged: (int index) {
_setTown(index);
},
childCount: towns.length,
itemBuilder: (_, index) {
String text = towns[index];
return Align(
alignment: Alignment.center,
child: Text(text,
style: TextStyle(
color: _pickerStyle.textColor,
fontSize: _pickerStyle.textSize ??
_pickerFontSize(text),
),
textAlign: TextAlign.start),
);
},
)),
)
: SizedBox()
if (hasTown)
Expanded(
child: Container(
padding: const EdgeInsets.all(8.0),
child: CupertinoPicker.builder(
scrollController: townScrollCtrl,
selectionOverlay: _pickerStyle.itemOverlay,
itemExtent: _pickerStyle.pickerItemHeight,
onSelectedItemChanged: _setTown,
childCount: towns.length,
itemBuilder: (_, int index) {
final String text = towns[index];
return Align(
alignment: Alignment.center,
child: Text(text,
style: TextStyle(
color: _pickerStyle.textColor,
fontSize: _pickerStyle.textSize ??
_pickerFontSize(text),
),
textAlign: TextAlign.start),
);
},
)),
)
else
const SizedBox()
],
),
);
@ -451,7 +446,7 @@ class _BottomPickerLayout extends SingleChildLayoutDelegate {
@override
Offset getPositionForChild(Size size, Size childSize) {
double height = size.height - childSize.height * progress;
final double height = size.height - childSize.height * progress;
return Offset(0.0, height);
}

View File

@ -7,13 +7,58 @@ enum PickerDataType {
ethnicity, //
}
var pickerData = {
PickerDataType.sex: ['不限', '', ''],
PickerDataType.education: ["高中以下", "高中", "大专", "本科", "硕士", "博士", "博士后", '其它'],
PickerDataType.subject: ["语文", "数学", "英语", "物理", "化学", "生物", "政治", "地理", "历史"],
PickerDataType.constellation: ["水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座"],
PickerDataType.zodiac: ['', '', '', '', '', '', '', '', '', '', '', ''],
PickerDataType.ethnicity: [
Map<PickerDataType, List<String>> pickerData = <PickerDataType, List<String>>{
PickerDataType.sex: <String>['不限', '', ''],
PickerDataType.education: <String>[
'高中以下',
'高中',
'大专',
'本科',
'硕士',
'博士',
'博士后',
'其它'
],
PickerDataType.subject: <String>[
'语文',
'数学',
'英语',
'物理',
'化学',
'生物',
'政治',
'地理',
'历史'
],
PickerDataType.constellation: <String>[
'水瓶座',
'双鱼座',
'白羊座',
'金牛座',
'双子座',
'巨蟹座',
'狮子座',
'处女座',
'天秤座',
'天蝎座',
'射手座',
'摩羯座'
],
PickerDataType.zodiac: <String>[
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
''
],
PickerDataType.ethnicity: <String>[
'汉族',
'蒙古族',
'回族',

View File

@ -1,10 +1,10 @@
// import 'package:flutter_pickers/time_picker/model/date_type.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_type.dart';
///
class Suffix {
Suffix(
{this.years = '',
this.month = '',
@ -14,12 +14,12 @@ class Suffix {
this.seconds = ''});
Suffix.normal() {
years = '';
month = '';
days = '';
hours = '';
minutes = '';
seconds = '';
years = ''.tr;
month = ''.tr;
days = ''.tr;
hours = ''.tr;
minutes = ''.tr;
seconds = ''.tr;
}
late String years;
late String month;

View File

@ -63,10 +63,13 @@ class _TitleAppBarState extends State<TitleAppBar> {
title: widget.haveTitleWidget!
? widget.titleWidget
: Text(widget.barTitle ?? '',
// '发生的发生的发生的发生大发三大发手打',
maxLines: 3,
textAlign: TextAlign.center,
style: TextStyle(
color: widget.titleColor ?? Colors.white,
fontSize: 28.sp,
fontWeight: FontWeight.w600)),
fontSize: 26.sp,
fontWeight: FontWeight.w500)),
centerTitle: true,
actions: widget.actionsList ?? []);
}