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