更新日历样式

This commit is contained in:
czz
2025-07-10 11:16:26 +08:00
parent ceb228b256
commit 30027f40c2
10 changed files with 502 additions and 480 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@@ -3,8 +3,11 @@ import 'package:get/get.dart';
import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/date/CalendarController.dart'; import 'package:vbvs_app/controller/date/CalendarController.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'SleepdateWidget.dart'; import 'SleepdateWidget.dart';
class SleepCalendarWidget extends StatefulWidget { class SleepCalendarWidget extends StatefulWidget {
@@ -12,9 +15,11 @@ class SleepCalendarWidget extends StatefulWidget {
final ValueChanged<DateTime>? onDateSelected; final ValueChanged<DateTime>? onDateSelected;
final int? type; // 新增参数,默认日历类型为日 final int? type; // 新增参数,默认日历类型为日
final Color highlightColor; // ✅ 新增 final Color highlightColor; // ✅ 新增
final String? mac;
const SleepCalendarWidget({ const SleepCalendarWidget({
super.key, super.key,
this.mac,
this.timestamp, this.timestamp,
this.onDateSelected, this.onDateSelected,
this.type = 1, this.type = 1,
@@ -27,27 +32,89 @@ class SleepCalendarWidget extends StatefulWidget {
class _SleepCalendarWidgetState extends State<SleepCalendarWidget> { class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
CalendarController calendarController = Get.find(); CalendarController calendarController = Get.find();
RxMap sleepDate = <String, dynamic>{}.obs;
RxList showLabel = <dynamic>[
{"level": 5, "name": "无报告", "color": "#9E9E9E"}
].obs;
// @override
// void initState() {
// super.initState();
// final initialDate = widget.timestamp != null
// ? DateTime.fromMillisecondsSinceEpoch(widget.timestamp!)
// : DateTime.now();
// calendarController.displayedMonth.value = initialDate;
// calendarController.selectedDate.value = initialDate;
// }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
final initialDate = widget.timestamp != null final initialDate = widget.timestamp != null
? DateTime.fromMillisecondsSinceEpoch(widget.timestamp!) ? DateTime.fromMillisecondsSinceEpoch(widget.timestamp!)
: DateTime.now(); : DateTime.now();
calendarController.displayedMonth.value = initialDate; calendarController.displayedMonth.value = initialDate;
calendarController.selectedDate.value = initialDate; calendarController.selectedDate.value = initialDate;
// 初始化请求
fetchDate(initialDate);
// 每当月份变化时,重新请求数据
ever(calendarController.displayedMonth, (DateTime newMonth) {
fetchDate(newMonth);
});
}
Future<void> fetchDate(DateTime timeStamp) async {
final dateStr = timeStamp.toString().split(' ')[0];
await requestWithLog(
logTitle: "查询睡眠报告",
method: MyHttpMethod.get,
queryUrl:
"https://sleepdata.he-info.com/api/analysis/sleep/analysis?mac=${widget.mac}&time=$dateStr&type=3",
onSuccess: (res) {
sleepDate.value = res.data;
showLabel.value = [
...res.data['scoreList']['type'],
{"level": 5, "name": "无报告", "color": "#9E9E9E"},
// ✅ 注意拼写是 scoreList
];
},
onFailure: (res) {
sleepDate.value = {};
showLabel.value = [
{"level": 5, "name": "无报告", "color": "#9E9E9E"},
];
},
);
}
Future<void> fetchSleepColor(DateTime timeStamp) async {
final dateStr = timeStamp.toString().split(' ')[0];
await requestWithLog(
logTitle: "查询睡眠报告",
method: MyHttpMethod.get,
queryUrl: "https://sleepdata.he-info.com/api/analysis/sleep/score/type",
onSuccess: (res) {
sleepDate.value = res.data;
showLabel.value = [
...res.data['scoreList']['type'],
{"level": 5, "name": "无报告", "color": "#9E9E9E"},
// ✅ 注意拼写是 scoreList
];
},
onFailure: (res) {
sleepDate.value = {};
showLabel.value = [
{"level": 5, "name": "无报告", "color": "#9E9E9E"},
];
},
);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
List<Map<String, dynamic>> showLabel = [
{"level": 1, "name": "优秀", "color": Color(0xFF4CAF50)},
{"level": 2, "name": "良好", "color": Color(0xFF8BC34A)},
{"level": 3, "name": "合格", "color": Color(0xFFFFC107)},
{"level": 4, "name": "注意", "color": Color(0xFFF44336)},
{"level": 5, "name": "无报告", "color": Color(0xFF9E9E9E)},
];
return Container( return Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -117,7 +184,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
); );
} }
Widget _buildCalendarBody(List<Map<String, dynamic>> showLabel) { Widget _buildCalendarBody(List<dynamic> showLabel) {
return Container( return Container(
width: double.infinity, width: double.infinity,
constraints: BoxConstraints(minHeight: 720.rpx), constraints: BoxConstraints(minHeight: 720.rpx),
@@ -135,9 +202,8 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
children: [ children: [
// 仅当为日历模式显示周标题 // 仅当为日历模式显示周标题
_buildWeekdayHeader(), _buildWeekdayHeader(),
// 日历日期格子,支持日和周的高亮逻辑 // 日历日期格子,支持日和周的高亮逻辑sleep
_buildCalendarGrid(calendarRows, selectedDate, sleepDate.value),
_buildCalendarGrid(calendarRows, selectedDate),
// TODO: 你可以扩展 month 类型的展示 // TODO: 你可以扩展 month 类型的展示
SizedBox(height: 55.rpx), SizedBox(height: 55.rpx),
_buildLegend(showLabel), _buildLegend(showLabel),
@@ -169,8 +235,8 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
); );
} }
Widget _buildCalendarGrid( Widget _buildCalendarGrid(List<List<DateTime>> calendarRows,
List<List<DateTime>> calendarRows, DateTime? selectedDate) { DateTime? selectedDate, Map sleepDate) {
final isMonthSelected = widget.type == 3; final isMonthSelected = widget.type == 3;
Widget content = Column( Widget content = Column(
@@ -197,6 +263,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
return Expanded( return Expanded(
child: SleepdateWidget( child: SleepdateWidget(
highlightColor: widget.highlightColor, // ✅ 传入高亮颜色 highlightColor: widget.highlightColor, // ✅ 传入高亮颜色
sleepDate: sleepDate,
date: date, date: date,
isSelected: isSelected, isSelected: isSelected,
onTap: () { onTap: () {
@@ -257,7 +324,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
} }
} }
Widget _buildLegend(List<Map<String, dynamic>> showLabel) { Widget _buildLegend(List showLabel) {
return Wrap( return Wrap(
spacing: 20.rpx, spacing: 20.rpx,
runSpacing: 20.rpx, runSpacing: 20.rpx,
@@ -271,7 +338,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
width: 20.rpx, width: 20.rpx,
height: 20.rpx, height: 20.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
color: item["color"], color: stringToColor(item["color"]),
borderRadius: BorderRadius.circular(10.rpx), borderRadius: BorderRadius.circular(10.rpx),
), ),
), ),

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart';
class SleepdateWidget extends StatelessWidget { class SleepdateWidget extends StatelessWidget {
@@ -7,17 +8,90 @@ class SleepdateWidget extends StatelessWidget {
final bool isSelected; final bool isSelected;
final VoidCallback onTap; final VoidCallback onTap;
final Color highlightColor; // 新增 final Color highlightColor; // 新增
final Map sleepDate;
const SleepdateWidget({ SleepdateWidget({
super.key, required this.sleepDate,
required this.date, required this.date,
required this.isSelected, required this.isSelected,
required this.onTap, required this.onTap,
this.highlightColor = Colors.black, // 默认值黑色 this.highlightColor = Colors.black, // 默认值黑色
}); });
@override
// Widget build(BuildContext context) {
// return ClickableContainer(
// onTap: onTap,
// backgroundColor: Colors.transparent,
// highlightColor: Colors.transparent,
// padding: EdgeInsets.all(4.rpx),
// child: Container(
// width: 90.rpx,
// height: 90.rpx,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(30.rpx),
// color: isSelected ? highlightColor : Colors.transparent, // 使用传入的颜色
// ),
// child: Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx),
// child: Container(
// decoration: BoxDecoration(
// color: Color(0xFF757575),
// shape: BoxShape.circle,
// ),
// alignment: Alignment.center,
// child: Text(
// '${date.day}',
// style: TextStyle(
// color: Colors.white,
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// ),
// ),
// ),
// ),
// ),
// );
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Color? fillColor;
// 判断是否存在 score 数据
final List<dynamic>? dataList = sleepDate['scoreList']?['data'];
final List<dynamic>? typeList = sleepDate['scoreList']?['type'];
if (dataList != null && typeList != null) {
// 查找是否有匹配日期的数据
for (var item in dataList) {
final st = item['st'];
final level = item['level'];
if (st is int) {
final itemDate =
DateTime.fromMillisecondsSinceEpoch(st).toLocal(); // 转为本地时间
// 判断是否是同一天
if (itemDate.year == date.year &&
itemDate.month == date.month &&
itemDate.day == date.day) {
// 找到对应 level 的颜色
final matchType = typeList.firstWhere(
(e) => e['level'] == level,
orElse: () => null,
);
if (matchType != null && matchType['color'] != null) {
final hexColor = matchType['color'];
fillColor = stringToColor(hexColor);
}
break; // 找到就跳出
}
}
}
}
return ClickableContainer( return ClickableContainer(
onTap: onTap, onTap: onTap,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
@@ -28,14 +102,14 @@ class SleepdateWidget extends StatelessWidget {
height: 90.rpx, height: 90.rpx,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.rpx), borderRadius: BorderRadius.circular(30.rpx),
color: isSelected ? highlightColor : Colors.transparent, // 使用传入的颜色 color: isSelected ? highlightColor : Colors.transparent,
), ),
child: Padding( child: Padding(
padding: padding:
EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx), EdgeInsetsDirectional.fromSTEB(10.rpx, 10.rpx, 10.rpx, 10.rpx),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFF757575), color: fillColor ?? Color(0xFF757575), // 如果匹配不到就默认灰色
shape: BoxShape.circle, shape: BoxShape.circle,
), ),
alignment: Alignment.center, alignment: Alignment.center,

View File

@@ -1328,28 +1328,49 @@ void showProgressDialog(
void showSleepCalendarBottomSheet({ void showSleepCalendarBottomSheet({
required BuildContext context, required BuildContext context,
int? timestamp, int? timestamp,
int? type = 1, // 新增参数默认值为1 int? type = 1,
String? mac,
required void Function(DateTime selectedDate) onDateSelected, required void Function(DateTime selectedDate) onDateSelected,
}) { }) {
showModalBottomSheet( showGeneralDialog(
context: context, context: context,
isScrollControlled: false, barrierDismissible: true,
backgroundColor: Colors.transparent, barrierLabel: 'Dismiss',
builder: (context) { barrierColor: Colors.black.withOpacity(0.4), // 移到这里,替代 Scaffold 背景
return Container( transitionDuration: const Duration(milliseconds: 300),
decoration: BoxDecoration( pageBuilder: (context, animation, secondaryAnimation) {
color: const Color(0xFF242835), return GestureDetector(
borderRadius: BorderRadius.only( onTap: () {
topLeft: Radius.circular(20.rpx), Navigator.of(context).pop(); // 点击空白关闭
topRight: Radius.circular(20.rpx), },
child: Material(
type: MaterialType.transparency,
child: Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () {}, // 阻止点击透传到外部(避免误关)
child: FractionallySizedBox(
widthFactor: 1.0,
heightFactor: 0.55,
child: Container(
decoration: BoxDecoration(
color: const Color(0xFF242835),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.rpx),
topRight: Radius.circular(20.rpx),
),
),
child: SleepCalendarWidget(
timestamp: timestamp,
type: type,
mac: mac,
onDateSelected: onDateSelected,
),
),
),
),
), ),
), ),
child: SleepCalendarWidget(
timestamp: timestamp,
type: type, // 传递类型给子组件
onDateSelected: onDateSelected,
// highlightColor: Colors.green,
),
); );
}, },
); );

View File

@@ -314,6 +314,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
), ),
), ),
), ),
Align( Align(
alignment: AlignmentDirectional(-1, 0), alignment: AlignmentDirectional(-1, 0),
child: Padding( child: Padding(

View File

@@ -317,16 +317,14 @@ class EditAddressPage extends GetView<AddressController>
), ),
), ),
Container( Container(
width: MediaQuery.sizeOf( // width: MediaQuery.sizeOf(
context) // context)
.width, // .width,
height: MediaQuery.sizeOf( height:
context) bodysize!.maxHeight *
.height * 0.038,
0.038, constraints: BoxConstraints(
constraints: minHeight: 61.rpx,
const BoxConstraints(
minHeight: 31,
), ),
decoration: BoxDecoration(), decoration: BoxDecoration(),
child: Row( child: Row(
@@ -339,19 +337,14 @@ class EditAddressPage extends GetView<AddressController>
context) context)
.width * .width *
0.17, 0.17,
height: decoration:
MediaQuery.sizeOf( BoxDecoration(),
context)
.height *
0.038,
constraints: constraints:
BoxConstraints( BoxConstraints(
minWidth: minWidth:
105.rpx, 105.rpx,
maxWidth: maxWidth:
105.rpx), 105.rpx),
decoration:
BoxDecoration(),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize MainAxisSize
@@ -375,8 +368,6 @@ class EditAddressPage extends GetView<AddressController>
), ),
Expanded( Expanded(
child: Container( child: Container(
width: 100,
height: 100,
decoration: decoration:
BoxDecoration( BoxDecoration(
color: color:
@@ -386,105 +377,120 @@ class EditAddressPage extends GetView<AddressController>
.circular( .circular(
8), 8),
), ),
child: width:
TextFormField( double.infinity,
// autofocus: true, child: Padding(
obscureText: padding:
false, EdgeInsetsDirectional
onChanged: (val) { .fromSTEB(
controller.model 35.rpx,
.name = val; 0,
}, 35.rpx,
0),
initialValue: child: Row(
address[ mainAxisSize:
'name'], MainAxisSize
decoration: .max,
InputDecoration( mainAxisAlignment:
contentPadding: MainAxisAlignment
EdgeInsets .spaceBetween,
.symmetric( children: [
vertical: Expanded(
25.rpx, child:
horizontal: Container(
26.rpx, child:
), Align(
labelStyle: alignment: AlignmentDirectional(
TextStyle( -1,
fontFamily: 0),
'Readex Pro', child:
letterSpacing: TextFormField(
0, onChanged:
), (value) {
hintStyle: controller.model.name =
TextStyle( value;
fontFamily: },
'Readex Pro', autofocus:
letterSpacing: false,
0, obscureText:
), false,
enabledBorder: decoration:
UnderlineInputBorder( InputDecoration(
borderSide: contentPadding:
const BorderSide( EdgeInsets.all(0),
color: Color( isDense:
0x00000000), true,
width: 2, labelStyle:
TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintStyle:
TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled:
false,
fillColor:
Colors.white,
),
style:
TextStyle(
fontFamily:
'Readex Pro',
letterSpacing:
0,
color:
Colors.black,
fontSize:
26.rpx,
),
// cursorColor:
// Colors.black,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
), ),
borderRadius: ],
BorderRadius
.circular(
8),
),
focusedBorder:
UnderlineInputBorder(
borderSide:
const BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
errorBorder:
UnderlineInputBorder(
borderSide:
const BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide:
const BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
),
style: TextStyle(
fontFamily:
'Readex Pro',
letterSpacing:
0,
color: Colors
.black,
fontSize:
26.rpx,
), ),
), ),
), ),
@@ -494,17 +500,16 @@ class EditAddressPage extends GetView<AddressController>
), ),
), ),
Container( Container(
width: MediaQuery.sizeOf( // width: MediaQuery.sizeOf(
context) // context)
.width, // .width,
height: MediaQuery.sizeOf( height:
context) bodysize!.maxHeight *
.height * 0.038,
0.038, constraints: BoxConstraints(
constraints: minHeight: 61.rpx,
const BoxConstraints(
minHeight: 31,
), ),
decoration: BoxDecoration(),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize.max, MainAxisSize.max,
@@ -515,19 +520,14 @@ class EditAddressPage extends GetView<AddressController>
context) context)
.width * .width *
0.17, 0.17,
height: decoration:
MediaQuery.sizeOf( BoxDecoration(),
context)
.height *
0.038,
constraints: constraints:
BoxConstraints( BoxConstraints(
minWidth: minWidth:
105.rpx, 105.rpx,
maxWidth: maxWidth:
105.rpx), 105.rpx),
decoration:
BoxDecoration(),
child: Row( child: Row(
mainAxisSize: mainAxisSize:
MainAxisSize MainAxisSize
@@ -535,136 +535,145 @@ class EditAddressPage extends GetView<AddressController>
children: [ children: [
Text( Text(
'手机号', '手机号',
style: style: TextStyle(
TextStyle( fontFamily:
fontFamily: 'Readex Pro',
'Readex Pro', fontSize:
fontSize: AppFontsize
AppFontsize .normal_text_size,
.normal_text_size, letterSpacing:
letterSpacing: 0,
0, color: Colors
color: Colors .white),
.white,
),
), ),
], ],
), ),
), ),
Expanded( Expanded(
child: Container( child: Container(
width: 100,
height: 100,
decoration: decoration:
BoxDecoration( BoxDecoration(
color:
Colors.white,
borderRadius: borderRadius:
BorderRadius BorderRadius
.circular( .circular(
8), 8),
color:
Colors.white,
), ),
child: width:
TextFormField( double.infinity,
// autofocus: true, child: Padding(
onChanged: (val) { padding:
controller.model EdgeInsetsDirectional
.tel = val; .fromSTEB(
}, 35.rpx,
textAlignVertical: 0,
TextAlignVertical 35.rpx,
.center, // 垂直居中 0),
obscureText: child: Row(
false, mainAxisSize:
initialValue: MainAxisSize
address[ .max,
'tel'], mainAxisAlignment:
decoration: MainAxisAlignment
InputDecoration( .spaceBetween,
contentPadding: children: [
EdgeInsets Expanded(
.symmetric( child:
vertical: Container(
25.rpx, child:
horizontal: Align(
26.rpx, alignment: AlignmentDirectional(
), -1,
labelStyle: 0),
TextStyle( child:
fontFamily: TextFormField(
'Readex Pro', onChanged:
letterSpacing: (value) {
0, controller.model.tel =
), value;
hintStyle: },
TextStyle( autofocus:
fontFamily: false,
'Readex Pro', obscureText:
letterSpacing: false,
0, decoration:
), InputDecoration(
enabledBorder: contentPadding:
UnderlineInputBorder( EdgeInsets.all(0),
borderSide: isDense:
const BorderSide( true,
color: Color( labelStyle:
0x00000000), TextStyle(
width: 2, fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
),
hintStyle:
TextStyle(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
errorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 1.rpx,
),
borderRadius: BorderRadius.circular(8.rpx),
),
filled:
false,
fillColor:
Colors.white,
),
style:
TextStyle(
fontFamily:
'Readex Pro',
letterSpacing:
0,
color:
Colors.black,
fontSize:
26.rpx,
),
// cursorColor:
// Colors.black,
// validator: _model
// .textControllerValidator
// .asValidator(context),
),
),
),
), ),
borderRadius: ],
BorderRadius
.circular(
8),
),
focusedBorder:
UnderlineInputBorder(
borderSide:
const BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
errorBorder:
UnderlineInputBorder(
borderSide:
const BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
focusedErrorBorder:
UnderlineInputBorder(
borderSide:
const BorderSide(
color: Color(
0x00000000),
width: 2,
),
borderRadius:
BorderRadius
.circular(
8),
),
),
style: TextStyle(
fontFamily:
'Readex Pro',
letterSpacing:
0,
color: Colors
.black,
fontSize:
26.rpx,
), ),
), ),
), ),
@@ -740,158 +749,6 @@ class EditAddressPage extends GetView<AddressController>
], ],
), ),
), ),
// Expanded(
// child: InkWell(
// onTap: () {
// CityPicker.show(
// context:
// context,
// cityPickerListener:
// this,
// // 在大屏/Web 上最大宽度为 600px
// // 移除内边距
// );
// },
// child: Container(
// width: 100,
// height: 100,
// decoration:
// BoxDecoration(
// color: const Color(
// 0xFFF3F5F6),
// borderRadius:
// BorderRadius
// .circular(
// 8),
// ),
// alignment:
// Alignment
// .center,
// child: Obx(() {
// return TextFormField(
// enabled:
// false,
// controller: controller.onReDraw(
// TextEditingController(
// text:
// controller.model.all_address),
// (val) {
// val.text =
// controller.model.all_address ??
// "";
// }),
// // autofocus: true,
// obscureText:
// false,
// maxLines: 1,
// textAlignVertical:
// TextAlignVertical
// .center, // 垂直居中
// decoration: InputDecoration(
// contentPadding: EdgeInsets.symmetric(
// vertical:
// 25.rpx,
// horizontal:
// 26.rpx,
// ),
// labelStyle: TextStyle(
// fontFamily:
// 'Readex Pro',
// letterSpacing:
// 0,
// ),
// hintStyle: TextStyle(
// fontFamily:
// 'Readex Pro',
// letterSpacing:
// 0,
// ),
// enabledBorder: UnderlineInputBorder(
// borderSide:
// const BorderSide(
// color:
// Color(0x00000000),
// width:
// 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// disabledBorder: UnderlineInputBorder(
// borderSide:
// const BorderSide(
// color:
// Color(0x00000000),
// width:
// 0,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// focusedBorder: UnderlineInputBorder(
// borderSide:
// const BorderSide(
// color:
// Color(0x00000000),
// width:
// 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// errorBorder: UnderlineInputBorder(
// borderSide:
// const BorderSide(
// color:
// Color(0x00000000),
// width:
// 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// focusedErrorBorder: UnderlineInputBorder(
// borderSide:
// const BorderSide(
// color:
// Color(0x00000000),
// width:
// 2,
// ),
// borderRadius:
// BorderRadius.circular(8),
// ),
// suffixIcon: Transform.rotate(
// angle:
// 1.5708, // 90 度相当于 pi / 2 弧度
// child:
// Icon(
// Icons.arrow_forward_ios,
// color:
// Colors.black,
// size:
// 26.rpx,
// ),
// )),
// style:
// TextStyle(
// fontFamily:
// 'Readex Pro',
// letterSpacing:
// 0,
// color: Color(
// 0xFF333333),
// fontSize:
// 26.rpx,
// overflow:
// TextOverflow
// .ellipsis,
// ),
// );
// })),
// ),
// ),
Expanded( Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
@@ -1087,7 +944,7 @@ class EditAddressPage extends GetView<AddressController>
vertical: vertical:
10.rpx, 10.rpx,
horizontal: horizontal:
26.rpx, 35.rpx,
), ),
labelStyle: labelStyle:
TextStyle( TextStyle(
@@ -1163,6 +1020,9 @@ class EditAddressPage extends GetView<AddressController>
fontSize: fontSize:
26.rpx, 26.rpx,
), ),
// cursorColor:
// Colors
// .black,
), ),
), ),
), ),

View File

@@ -22,8 +22,10 @@ class MessageDetailPage extends StatefulWidget {
class _MessageDetailPageState extends State<MessageDetailPage> { class _MessageDetailPageState extends State<MessageDetailPage> {
MHDeviceShareController controller = Get.find(); MHDeviceShareController controller = Get.find();
MhMessageController messageController = Get.find(); MhMessageController messageController = Get.find();
RxInt status = 0.obs;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
status.value = widget.data['status'];
var messageInfo = widget.data; var messageInfo = widget.data;
return LayoutBuilder( return LayoutBuilder(
builder: (context, boxConstraints) => GestureDetector( builder: (context, boxConstraints) => GestureDetector(
@@ -171,34 +173,32 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
), ),
width: double.infinity, width: double.infinity,
child: TextButton( child: TextButton(
onPressed: () async { onPressed: () async {
if (widget.data['status'] == 1) { if (widget.data['status'] == 1) {
ApiResponse apiResponse = ApiResponse apiResponse = await controller
await controller.confirmShare(widget.data['data']['shareCode']); .confirmShare(widget.data['data']['shareCode']);
if (apiResponse.code == HttpStatusCodes.ok) { if (apiResponse.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: apiResponse.msg!, textColor: Color(0xFF00C1AA)); text: apiResponse.msg!, textColor: Color(0xFF00C1AA));
messageController.getMessageList(); messageController.getMessageList();
messageController.updateAll(); messageController.updateAll();
} else { } else {
TopSlideNotification.show(context, TopSlideNotification.show(context,
text: apiResponse.msg!, textColor: Color(0XFFFF7159)); text: apiResponse.msg!, textColor: Color(0XFFFF7159));
messageController.getMessageList(); messageController.getMessageList();
messageController.updateAll(); messageController.updateAll();
}
} }
} },
}, child: Obx(() => Text(
child: Text( getStatusText(status.value),
getStatusText(widget.data['status']), style: TextStyle(
style: TextStyle( fontFamily: 'Readex Pro',
fontFamily: 'Readex Pro', color: status.value == 1 ? Colors.white : Color(0xFF929699),
color: fontSize: 26.rpx,
widget.data['status'] == 1 ? Colors.white : Color(0xFF929699), letterSpacing: 0,
fontSize: 26.rpx, ),
letterSpacing: 0, ))),
),
),
),
); );
} }

View File

@@ -63,7 +63,7 @@ class RepairHistoryWidget extends GetView<RepairInfoController> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
repairListController.model.repairList[index]['device'] repairListController.model.repairList[index]['device'][0]
['mac'] ?? ['mac'] ??
'', '',
style: TextStyle( style: TextStyle(

View File

@@ -1430,7 +1430,7 @@ class MHTLoginPage extends GetView<MHTLoginController> {
'Readex Pro', 'Readex Pro',
color: color:
Colors.white, Colors.white,
fontSize: 12, fontSize: 23.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
), ),
@@ -1458,7 +1458,7 @@ class MHTLoginPage extends GetView<MHTLoginController> {
color: color:
stringToColor( stringToColor(
"FF9F66"), "FF9F66"),
fontSize: 12, fontSize: 23.rpx,
letterSpacing: letterSpacing:
0, 0,
), ),
@@ -1476,7 +1476,7 @@ class MHTLoginPage extends GetView<MHTLoginController> {
'Readex Pro', 'Readex Pro',
color: color:
Colors.white, Colors.white,
fontSize: 12, fontSize: 23.rpx,
letterSpacing: 0, letterSpacing: 0,
), ),
), ),
@@ -1504,7 +1504,7 @@ class MHTLoginPage extends GetView<MHTLoginController> {
color: color:
stringToColor( stringToColor(
"FF9F66"), "FF9F66"),
fontSize: 12, fontSize: 23.rpx,
letterSpacing: letterSpacing:
0, 0,
), ),

View File

@@ -886,8 +886,6 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
final today = DateTime(now.year, now.month, now.day); final today = DateTime(now.year, now.month, now.day);
DateTime targetDate = selectedDate; DateTime targetDate = selectedDate;
if (type == 1) { if (type == 1) {
final nextDate = selectedDate.add(const Duration(days: 1)); final nextDate = selectedDate.add(const Duration(days: 1));
if (!nextDate.isAfter(today)) { if (!nextDate.isAfter(today)) {
@@ -1085,6 +1083,7 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
type: sleepReportController.model.type, type: sleepReportController.model.type,
timestamp: selectedDate.millisecondsSinceEpoch, timestamp: selectedDate.millisecondsSinceEpoch,
context: context, context: context,
mac: widget.data['mac'],
onDateSelected: (newDate) { onDateSelected: (newDate) {
sleepReportController.selectedDate.value = newDate; sleepReportController.selectedDate.value = newDate;
calendarController.selectedDate.value = newDate; calendarController.selectedDate.value = newDate;
@@ -1121,9 +1120,9 @@ class _NewSleepReportPageState extends State<NewSleepReportPage> {
}, },
); );
}, },
child: SizedBox( child: Container(
width: 28.rpx, width: 36.rpx,
height: 28.rpx, height: 36.rpx,
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/img/icon/calendar.svg', 'assets/img/icon/calendar.svg',
fit: BoxFit.cover, fit: BoxFit.cover,