From 652a46aa3ed8ee9c741a69aafebf09a8876c2dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com> Date: Wed, 20 Nov 2024 10:04:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lan/lan_el.json | 2 +- lan/lan_fr.json | 2 +- lib/app.dart | 2 - .../sendElectronicKey_page.dart | 7 +- lib/mine/mine/safeVerify/safeVerify_page.dart | 101 ++++++++------- lib/mine/mineSet/mineSet/mineSet_page.dart | 57 +++++++-- .../route/address_picker_route.dart | 119 +++++++++--------- lib/tools/pickers/more_pickers/init_data.dart | 59 +++++++-- .../pickers/time_picker/model/suffix.dart | 14 +-- lib/tools/titleAppBar.dart | 7 +- 10 files changed, 221 insertions(+), 149 deletions(-) diff --git a/lan/lan_el.json b/lan/lan_el.json index e9df61fe..ff1eca35 100644 --- a/lan/lan_el.json +++ b/lan/lan_el.json @@ -16,7 +16,7 @@ "添加者": "Αερομεταφορέας", "添加时间": "Χρόνο", "重置": "Επαναφοράς", - "请输入手机号或者邮箱": "Αριθμός τηλεφώνου ή email", + "请输入手机号或者邮箱": "Tηλεφώνο/email", "工作时间": "Χρόνος εργασίας", "工作日设置": "Ρύθμιση ημέρας εργασίας", "星期一": "Δευτέρα.", diff --git a/lan/lan_fr.json b/lan/lan_fr.json index e390d100..90fe8383 100644 --- a/lan/lan_fr.json +++ b/lan/lan_fr.json @@ -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", diff --git a/lib/app.dart b/lib/app.dart index 247d211b..2ecca8cc 100755 --- a/lib/app.dart +++ b/lib/app.dart @@ -171,5 +171,3 @@ Future getAgreePrivacyShowUpdate() async { AppFirstEnterHandle().getAppFirstEnter(isShowUpdateVersion); } } - - diff --git a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart index 882fb2df..13ee46ed 100755 --- a/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart +++ b/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart @@ -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 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, diff --git a/lib/mine/mine/safeVerify/safeVerify_page.dart b/lib/mine/mine/safeVerify/safeVerify_page.dart index 8213c3d0..ac73e112 100755 --- a/lib/mine/mine/safeVerify/safeVerify_page.dart +++ b/lib/mine/mine/safeVerify/safeVerify_page.dart @@ -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 { 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 { // } : null, // ), ), - )), + )), SizedBox( height: 60.h, ), @@ -103,46 +101,45 @@ class _SafeVerifyPageState extends State { 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( diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index a96f23d8..83b51a57 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -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 })), */ 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 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 leftTitel: '客服'.tr, isHaveLine: widget.showAbout, isHaveDirection: true, - action: (){ + action: () { WechatManageTool.getAppInfo(CustomerTool.openCustomerService); }, ), @@ -458,6 +454,45 @@ class _MineSetPageState extends State ); } + 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: [ + 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( diff --git a/lib/tools/pickers/address_picker/route/address_picker_route.dart b/lib/tools/pickers/address_picker/route/address_picker_route.dart index 43144f7e..9fce43ba 100755 --- a/lib/tools/pickers/address_picker/route/address_picker_route.dart +++ b/lib/tools/pickers/address_picker/route/address_picker_route.dart @@ -97,14 +97,14 @@ class AddressPickerRoute extends PopupRoute { } 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 createState() => _PickerState(this.initProvince, - this.initCity, this.initTown, this.addAllItem, this.pickerStyle); + State 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 viewList = []; + final List viewList = []; 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); } diff --git a/lib/tools/pickers/more_pickers/init_data.dart b/lib/tools/pickers/more_pickers/init_data.dart index 4154da33..d05e2f80 100755 --- a/lib/tools/pickers/more_pickers/init_data.dart +++ b/lib/tools/pickers/more_pickers/init_data.dart @@ -7,13 +7,58 @@ enum PickerDataType { ethnicity, // 名族 } -var pickerData = { - PickerDataType.sex: ['不限', '男', '女'], - PickerDataType.education: ["高中以下", "高中", "大专", "本科", "硕士", "博士", "博士后", '其它'], - PickerDataType.subject: ["语文", "数学", "英语", "物理", "化学", "生物", "政治", "地理", "历史"], - PickerDataType.constellation: ["水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "摩羯座"], - PickerDataType.zodiac: ['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪'], - PickerDataType.ethnicity: [ +Map> pickerData = >{ + PickerDataType.sex: ['不限', '男', '女'], + PickerDataType.education: [ + '高中以下', + '高中', + '大专', + '本科', + '硕士', + '博士', + '博士后', + '其它' + ], + PickerDataType.subject: [ + '语文', + '数学', + '英语', + '物理', + '化学', + '生物', + '政治', + '地理', + '历史' + ], + PickerDataType.constellation: [ + '水瓶座', + '双鱼座', + '白羊座', + '金牛座', + '双子座', + '巨蟹座', + '狮子座', + '处女座', + '天秤座', + '天蝎座', + '射手座', + '摩羯座' + ], + PickerDataType.zodiac: [ + '鼠', + '牛', + '虎', + '兔', + '龙', + '蛇', + '马', + '羊', + '猴', + '鸡', + '狗', + '猪' + ], + PickerDataType.ethnicity: [ '汉族', '蒙古族', '回族', diff --git a/lib/tools/pickers/time_picker/model/suffix.dart b/lib/tools/pickers/time_picker/model/suffix.dart index a84037f1..3a903a21 100755 --- a/lib/tools/pickers/time_picker/model/suffix.dart +++ b/lib/tools/pickers/time_picker/model/suffix.dart @@ -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; diff --git a/lib/tools/titleAppBar.dart b/lib/tools/titleAppBar.dart index 57c8265f..bffe2184 100755 --- a/lib/tools/titleAppBar.dart +++ b/lib/tools/titleAppBar.dart @@ -63,10 +63,13 @@ class _TitleAppBarState extends State { 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 ?? []); }