多语言后端数据
This commit is contained in:
@@ -32,7 +32,7 @@ class SleepCalendarWidget extends StatefulWidget {
|
||||
|
||||
class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
CalendarController calendarController = Get.find();
|
||||
RxMap sleepDate = <String, dynamic>{}.obs;
|
||||
RxMap sleepDate = <dynamic, dynamic>{}.obs;
|
||||
RxList showLabel = <dynamic>[
|
||||
{"level": 5, "name": "无报告", "color": "#9E9E9E"}
|
||||
].obs;
|
||||
@@ -206,7 +206,8 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
return Container(
|
||||
constraints: BoxConstraints(minHeight: 90.rpx),
|
||||
child: Row(
|
||||
children: ["一".tr, "二".tr, "三".tr, "四".tr, "五".tr, "六".tr, "日".tr].map((day) {
|
||||
children:
|
||||
["一".tr, "二".tr, "三".tr, "四".tr, "五".tr, "六".tr, "日".tr].map((day) {
|
||||
return Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
@@ -223,6 +224,96 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
// Widget _buildCalendarGrid(List<List<DateTime>> calendarRows,
|
||||
// DateTime? selectedDate, Map sleepDate) {
|
||||
// final isMonthSelected = widget.type == 3;
|
||||
|
||||
// Widget content = Column(
|
||||
// children: calendarRows.map((week) {
|
||||
// final isWeekSelected = widget.type == 2 &&
|
||||
// selectedDate != null &&
|
||||
// week.any((d) =>
|
||||
// d.year == selectedDate.year &&
|
||||
// d.month == selectedDate.month &&
|
||||
// d.day == selectedDate.day);
|
||||
|
||||
// final row = Row(
|
||||
// children: week.map((date) {
|
||||
// if (date.year == 0) {
|
||||
// return const Expanded(child: SizedBox.shrink());
|
||||
// }
|
||||
|
||||
// final isSelected = widget.type == 1 &&
|
||||
// selectedDate != null &&
|
||||
// date.year == selectedDate.year &&
|
||||
// date.month == selectedDate.month &&
|
||||
// date.day == selectedDate.day;
|
||||
|
||||
// return Expanded(
|
||||
// child: SleepdateWidget(
|
||||
// highlightColor: widget.highlightColor, // ✅ 传入高亮颜色
|
||||
// sleepDate: sleepDate,
|
||||
// date: date,
|
||||
// isSelected: isSelected,
|
||||
// onTap: () {
|
||||
// calendarController.selectDate(date);
|
||||
// widget.onDateSelected?.call(date);
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }).toList(),
|
||||
// );
|
||||
|
||||
// if (isWeekSelected) {
|
||||
// return Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: widget.highlightColor,
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(AppConstants().button_container_radius),
|
||||
// ),
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// vertical: 6.rpx, horizontal: 12.rpx), // 增加左右padding
|
||||
// margin: EdgeInsets.symmetric(vertical: 6.rpx),
|
||||
// child: row,
|
||||
// );
|
||||
// } else {
|
||||
// return row;
|
||||
// }
|
||||
// }).toList(),
|
||||
// );
|
||||
|
||||
// // 如果是月份模式,包一层黑色背景容器
|
||||
// if (isMonthSelected && selectedDate != null) {
|
||||
// final displayedMonth = calendarController.displayedMonth.value;
|
||||
|
||||
// final isSameMonth = displayedMonth.year == selectedDate.year &&
|
||||
// displayedMonth.month == selectedDate.month;
|
||||
|
||||
// if (isSameMonth) {
|
||||
// // ✅ 当前显示的月 == 当前选中的月 → 加高亮外框
|
||||
// return Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: widget.highlightColor, // 背景淡色
|
||||
// borderRadius:
|
||||
// BorderRadius.circular(AppConstants().normal_container_radius),
|
||||
// // border: Border.all(
|
||||
// // color: widget.highlightColor,
|
||||
// // width: 2.rpx,
|
||||
// // ),
|
||||
// ),
|
||||
// // padding: EdgeInsets.symmetric(vertical: 0.rpx, horizontal: 0.rpx),
|
||||
// // margin: EdgeInsets.symmetric(vertical: 0.rpx),
|
||||
// child: content,
|
||||
// );
|
||||
// } else {
|
||||
// return content;
|
||||
// }
|
||||
// } else {
|
||||
// return content;
|
||||
// }
|
||||
// }
|
||||
|
||||
Widget _buildCalendarGrid(List<List<DateTime>> calendarRows,
|
||||
DateTime? selectedDate, Map sleepDate) {
|
||||
final isMonthSelected = widget.type == 3;
|
||||
@@ -250,7 +341,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
|
||||
return Expanded(
|
||||
child: SleepdateWidget(
|
||||
highlightColor: widget.highlightColor, // ✅ 传入高亮颜色
|
||||
highlightColor: widget.highlightColor,
|
||||
sleepDate: sleepDate,
|
||||
date: date,
|
||||
isSelected: isSelected,
|
||||
@@ -271,8 +362,8 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
borderRadius:
|
||||
BorderRadius.circular(AppConstants().button_container_radius),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 6.rpx),
|
||||
margin: EdgeInsets.symmetric(vertical: 6.rpx),
|
||||
// 把padding改成margin,避免Row宽度变化导致跳动
|
||||
margin: EdgeInsets.symmetric(vertical: 6.rpx, horizontal: 12.rpx),
|
||||
child: row,
|
||||
);
|
||||
} else {
|
||||
@@ -281,7 +372,7 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
// 如果是月份模式,包一层黑色背景容器
|
||||
// 月视图高亮逻辑不变
|
||||
if (isMonthSelected && selectedDate != null) {
|
||||
final displayedMonth = calendarController.displayedMonth.value;
|
||||
|
||||
@@ -289,19 +380,12 @@ class _SleepCalendarWidgetState extends State<SleepCalendarWidget> {
|
||||
displayedMonth.month == selectedDate.month;
|
||||
|
||||
if (isSameMonth) {
|
||||
// ✅ 当前显示的月 == 当前选中的月 → 加高亮外框
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: widget.highlightColor, // 背景淡色
|
||||
color: widget.highlightColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(AppConstants().normal_container_radius),
|
||||
// border: Border.all(
|
||||
// color: widget.highlightColor,
|
||||
// width: 2.rpx,
|
||||
// ),
|
||||
),
|
||||
// padding: EdgeInsets.symmetric(vertical: 0.rpx, horizontal: 0.rpx),
|
||||
// margin: EdgeInsets.symmetric(vertical: 0.rpx),
|
||||
child: content,
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import '../../common/color/appFontsize.dart';
|
||||
import '../../controller/mh_controller/apply_repair_controller.dart';
|
||||
|
||||
@@ -21,31 +22,20 @@ class ImgPreviewWidget extends GetView {
|
||||
width: MediaQuery.sizeOf(context).width * 0.25,
|
||||
height: MediaQuery.sizeOf(context).height * 0.15,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 140,
|
||||
),
|
||||
// minHeight: 140,
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
height: MediaQuery.sizeOf(context).height * 0.116,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Image.network(
|
||||
imgUrl,
|
||||
|
||||
// applyRepairController.getPublicUrl(imgUrl),
|
||||
width: 300,
|
||||
height: 200,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1, // 保证宽高比1:1
|
||||
child: Image.network(
|
||||
imgUrl,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -76,3 +66,55 @@ class ImgPreviewWidget extends GetView {
|
||||
);
|
||||
}
|
||||
}
|
||||
// class ImgPreviewWidget extends GetView {
|
||||
// final String imgUrl;
|
||||
// final int index;
|
||||
// final ApplyRepairController applyRepairController;
|
||||
// final bool isDel;
|
||||
|
||||
// ImgPreviewWidget({
|
||||
// required this.imgUrl,
|
||||
// required this.index,
|
||||
// required this.applyRepairController,
|
||||
// required this.isDel,
|
||||
// });
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Column(
|
||||
// mainAxisSize: MainAxisSize.min, // 不撑满 ListView 高度
|
||||
// children: [
|
||||
// // 正方形图片容器
|
||||
// AspectRatio(
|
||||
// aspectRatio: 1,
|
||||
// child: ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(8),
|
||||
// child: Image.network(
|
||||
// imgUrl,
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// // 删除按钮
|
||||
// if (isDel)
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top: 6),
|
||||
// child: InkWell(
|
||||
// onTap: () {
|
||||
// applyRepairController.model.issue_img!.removeAt(index);
|
||||
// applyRepairController.updateAll();
|
||||
// },
|
||||
// child: Text(
|
||||
// '删除',
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: Color(0xFF9EA4B7),
|
||||
// fontSize: AppFontsize.small_text_size,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
|
||||
class TopSlideNotification extends StatefulWidget {
|
||||
BuildContext?context;
|
||||
final String text;
|
||||
double? fontSize = 26.rpx;
|
||||
Color? textColor;
|
||||
|
||||
Reference in New Issue
Block a user