更新打鼾图显示
This commit is contained in:
@@ -65,6 +65,7 @@ Widget getOnePickers(
|
||||
void Function(int)? onChanged,
|
||||
bool isMonthName = false,
|
||||
Key? pickerKey,
|
||||
Color? selectedColor, // ✅ 新增:选中颜色(可选)
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false;
|
||||
@@ -87,15 +88,14 @@ Widget getOnePickers(
|
||||
},
|
||||
childCount: arr.length,
|
||||
itemBuilder: (context, index) {
|
||||
bool isSelected = index == selectedIndex.value;
|
||||
final bool isSelected = index == selectedIndex.value;
|
||||
|
||||
// 处理显示文本
|
||||
// 显示文本
|
||||
String displayText;
|
||||
if (isMonthName && isEn && arr[index] is int) {
|
||||
displayText = DateFormat.MMMM('en').format(DateTime(0, arr[index]));
|
||||
} else {
|
||||
// displayText = isEn ? "${arr[index]}" : "${arr[index]}$unit"; // 中文附带单位
|
||||
displayText = "${arr[index]}$unit"; // 中文附带单位
|
||||
displayText = "${arr[index]}$unit";
|
||||
}
|
||||
|
||||
return Center(
|
||||
@@ -104,7 +104,8 @@ Widget getOnePickers(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: isSelected
|
||||
? themeController.currentColor.sc3
|
||||
? (selectedColor ??
|
||||
themeController.currentColor.sc3) // ✅ 优先使用外部颜色
|
||||
: const Color(0xFF9AA0B3),
|
||||
fontSize: 30.rpx,
|
||||
fontWeight: FontWeight.normal,
|
||||
@@ -329,6 +330,8 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
monthIndex,
|
||||
isMonthName: true,
|
||||
onChanged: (_) => updateDays(),
|
||||
selectedColor:
|
||||
stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@@ -336,6 +339,8 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
context,
|
||||
daysSelect,
|
||||
dayIndex,
|
||||
selectedColor:
|
||||
stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@@ -344,6 +349,8 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
years,
|
||||
yearIndex,
|
||||
onChanged: (_) => updateDays(),
|
||||
selectedColor:
|
||||
stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -355,6 +362,8 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
yearIndex,
|
||||
unit: "年",
|
||||
onChanged: (_) => updateDays(),
|
||||
selectedColor:
|
||||
stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@@ -364,6 +373,8 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
monthIndex,
|
||||
unit: "月",
|
||||
onChanged: (_) => updateDays(),
|
||||
selectedColor:
|
||||
stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
@@ -372,6 +383,8 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
daysSelect,
|
||||
dayIndex,
|
||||
unit: "日",
|
||||
selectedColor:
|
||||
stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -688,6 +701,7 @@ Future<void> showWeightPickerDialog(
|
||||
weights,
|
||||
tempIndex, // ✅ 传入 RxInt
|
||||
unit: "kg",
|
||||
selectedColor: stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -815,6 +829,7 @@ Future<void> showHeightPickerDialog(
|
||||
heights,
|
||||
tempIndex, // ✅ 传入 RxInt
|
||||
unit: "cm",
|
||||
selectedColor: stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1088,6 +1103,7 @@ Future showOneSelectionDialog(
|
||||
arr,
|
||||
selectedIndex,
|
||||
unit: '',
|
||||
selectedColor: stringToColor("#003058"),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user