更新返回按钮样式统一样式
This commit is contained in:
@@ -20,11 +20,11 @@ LanguageController languageController = Get.find();
|
||||
MHLanguageController mhLanguageController = Get.find();
|
||||
|
||||
class MyUtils {
|
||||
|
||||
static String formatTimestampToSleep(int milliseconds) {
|
||||
final date = DateTime.fromMillisecondsSinceEpoch(milliseconds);
|
||||
return "${date.year}-${date.month}-${date.day}";
|
||||
}
|
||||
|
||||
static String formatDate(DateTime dateTime) {
|
||||
return "${dateTime.year}-${dateTime.month}-${dateTime.day.toString().padLeft(2, '0')}";
|
||||
}
|
||||
@@ -382,32 +382,13 @@ var closeIconWhite = GestureDetector(
|
||||
),
|
||||
);
|
||||
|
||||
var returnIconButtom = IconButton(
|
||||
// padding: EdgeInsets.zero, // 去除默认 padding
|
||||
// constraints: BoxConstraints(), // 去除最小尺寸限制
|
||||
onPressed: () => Get.back(),
|
||||
icon: Icon(Icons.navigate_before, size: 60.rpx),
|
||||
var returnIconButtom = returnIconButtomNew(
|
||||
onBack: () {
|
||||
// ⚡这里写你需要在返回前执行的逻辑
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
|
||||
// var returnIconButtomNew = ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.transparent,
|
||||
// padding: EdgeInsets.fromLTRB(20.rpx, 20.rpx, 20.rpx, 20.rpx),
|
||||
// onTap: () => Get.back(),
|
||||
// child: Container(
|
||||
// // height: 42.rpx,
|
||||
// // width: 42.rpx,
|
||||
// child: SvgPicture.asset(
|
||||
// 'assets/img/icon/return_buttom.svg',
|
||||
// width: 42.rpx,
|
||||
// height: 42.rpx,
|
||||
// ),
|
||||
// // SvgPicture.asset(
|
||||
// // 'assets/img/icon/expand.svg',
|
||||
// // color: Colors.white,
|
||||
// // )
|
||||
// ));
|
||||
|
||||
Widget returnIconButtomNew({VoidCallback? onBack}) {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -425,29 +406,25 @@ Widget returnIconButtomNew({VoidCallback? onBack}) {
|
||||
);
|
||||
}
|
||||
|
||||
// IconButton(
|
||||
// padding: EdgeInsets.zero, // 去除默认 padding
|
||||
// constraints: BoxConstraints(), // 去除最小尺寸限制
|
||||
// onPressed: () => Get.back(),
|
||||
// icon: SvgPicture.asset(
|
||||
// 'assets/img/icon/return_buttom.svg',
|
||||
// width: 42.rpx,
|
||||
// height: 42.rpx,
|
||||
// ),
|
||||
// );
|
||||
|
||||
var returnIconButtomAddCallback = (
|
||||
VoidCallback? returnCallBack, {
|
||||
bool enableBack = true,
|
||||
}) {
|
||||
return IconButton(
|
||||
onPressed: () {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
padding: EdgeInsets.fromLTRB(20.rpx, 20.rpx, 20.rpx, 20.rpx),
|
||||
onTap: () {
|
||||
returnCallBack?.call();
|
||||
if (enableBack) {
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.navigate_before, size: 60.rpx),
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/return_buttom.svg',
|
||||
width: 42.rpx,
|
||||
height: 42.rpx,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -329,7 +329,12 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
Container(
|
||||
width:
|
||||
MediaQuery.sizeOf(context)
|
||||
.width *
|
||||
0.2,
|
||||
child: Text(
|
||||
'${device['person']?['name'] ?? '未命名'.tr}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
@@ -338,6 +343,10 @@ class _InstantBodyPageState extends State<InstantBodyPage>
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// Text(
|
||||
// '${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']?['birthday'])) ?? '未知数据'.tr}',
|
||||
|
||||
@@ -142,7 +142,11 @@ class _MessageReviewPageState extends State<MessageReviewPage> {
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
Container(
|
||||
width: MediaQuery.sizeOf(context)
|
||||
.width *
|
||||
0.2,
|
||||
child: Text(
|
||||
'${widget.data['person']?['name'] ?? '未命名'.tr}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
@@ -151,6 +155,9 @@ class _MessageReviewPageState extends State<MessageReviewPage> {
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
// Text(
|
||||
// '${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(widget.data['person']?['birthday'])) ?? '未知数据'.tr}',
|
||||
|
||||
Reference in New Issue
Block a user