fix:修复锁设备名字过长的问题
This commit is contained in:
parent
22d6388bff
commit
f9fdb1b6ce
@ -861,5 +861,6 @@
|
||||
"四": "Thu",
|
||||
"五": "Fri",
|
||||
"六": "Sat",
|
||||
"日": "Sun"
|
||||
"日": "Sun",
|
||||
"星星锁": "Star lock"
|
||||
}
|
||||
|
||||
@ -893,5 +893,6 @@
|
||||
"四":"四",
|
||||
"五":"五",
|
||||
"六":"六",
|
||||
"日":"日"
|
||||
"日":"日",
|
||||
"星星锁": "星星锁"
|
||||
}
|
||||
|
||||
@ -863,5 +863,6 @@
|
||||
"四": "四",
|
||||
"五": "五",
|
||||
"六": "六",
|
||||
"日": "日"
|
||||
"日": "日",
|
||||
"星星锁": "星星锁"
|
||||
}
|
||||
|
||||
@ -46,7 +46,8 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
||||
xhjCall: () => Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: keyInfos.lockAlias,
|
||||
barTitle: F.sw(
|
||||
xhjCall: () => '星星锁', skyCall: () => keyInfos.lockAlias),
|
||||
haveBack: true,
|
||||
backgroundColor: Colors.white,
|
||||
titleColor: AppColors.blackColor,
|
||||
|
||||
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
|
||||
@ -153,10 +153,22 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Obx(() {
|
||||
final String lockAlias = state.keyInfos.value.lockAlias!;
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.w),
|
||||
child: Text(
|
||||
lockAlias,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 24.sp, color: Colors.black),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 35.h,
|
||||
),
|
||||
@ -1280,6 +1292,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
}
|
||||
|
||||
Widget _unlockSuccessWidget() {
|
||||
String lockAlias = state.keyInfos.value.lockAlias!;
|
||||
final TextStyle lockAliasTextStyle =
|
||||
TextStyle(color: AppColors.placeholderTextColor, fontSize: 24.sp);
|
||||
final TextPainter textPainter = TextPainter(
|
||||
text: TextSpan(text: lockAlias, style: lockAliasTextStyle),
|
||||
maxLines: 1,
|
||||
textDirection: TextDirection.ltr)
|
||||
..layout(minWidth: 0, maxWidth: double.infinity);
|
||||
|
||||
final double textSizeWidth = textPainter.size.width; // 获取文本的尺寸
|
||||
if (textSizeWidth > 358.w * 2 - 20) {
|
||||
lockAlias = '${lockAlias.substring(0, 25)}...';
|
||||
}
|
||||
return Center(
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
@ -1298,9 +1323,10 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
state.keyInfos.value.lockAlias!,
|
||||
lockAlias,
|
||||
style: TextStyle(
|
||||
color: AppColors.placeholderTextColor, fontSize: 24.sp),
|
||||
maxLines: 2,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
@ -1337,7 +1363,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// 获取当前时间
|
||||
final DateTime now = DateTime.now();
|
||||
// 格式化日期和时间
|
||||
final String formattedTime = DateFormat('MM/dd HH:mm').format(now);
|
||||
final String formattedTime = intl.DateFormat('MM/dd HH:mm').format(now);
|
||||
return formattedTime;
|
||||
}
|
||||
|
||||
|
||||
@ -169,6 +169,25 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
|
||||
Widget _xhjLockInfoListItem(
|
||||
LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
|
||||
String lockAlias = keyInfo.lockAlias!;
|
||||
final TextStyle lockAliasTextStyle = TextStyle(
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: keyInfo.passageMode == 1
|
||||
? AppColors.openPassageModeColor
|
||||
: AppColors.darkGrayTextColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
final TextPainter textPainter = TextPainter(
|
||||
text: TextSpan(text: lockAlias, style: lockAliasTextStyle),
|
||||
maxLines: 1,
|
||||
textDirection: TextDirection.ltr)
|
||||
..layout(minWidth: 0, maxWidth: double.infinity);
|
||||
|
||||
final double textSizeWidth = textPainter.size.width; // 获取文本的尺寸
|
||||
if (textSizeWidth > Get.width * .6) {
|
||||
lockAlias = '${lockAlias.substring(0, 14)}...';
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -204,16 +223,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(keyInfo.lockAlias!,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: keyInfo.passageMode == 1
|
||||
? AppColors.openPassageModeColor
|
||||
: AppColors.darkGrayTextColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 1),
|
||||
child: Text(lockAlias, style: lockAliasTextStyle, maxLines: 1),
|
||||
),
|
||||
Visibility(
|
||||
visible: keyInfo.passageMode == 1,
|
||||
|
||||
@ -94,7 +94,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
leftWidget: Builder(
|
||||
builder: (context) => IconButton(
|
||||
icon: Image.asset(
|
||||
"images/main/mainLeft_menu_icon.png",
|
||||
'images/main/mainLeft_menu_icon.png',
|
||||
color: Colors.white,
|
||||
width: 44.w,
|
||||
height: 44.w,
|
||||
@ -215,9 +215,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
SizedBox(
|
||||
height: 160.h,
|
||||
),
|
||||
F.isLite
|
||||
? Container()
|
||||
: SubmitBtn(
|
||||
if (F.isLite) Container() else SubmitBtn(
|
||||
btnName: '演示模式',
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user