This commit is contained in:
wyf
2025-05-23 14:51:09 +08:00
parent 8a418c9c98
commit c650bad8b1
36 changed files with 1297 additions and 892 deletions

View File

@@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
Future showDateSelectionDialog(BuildContext context,
@@ -68,70 +69,76 @@ Future showDateSelectionDialog(BuildContext context,
color: themeController.currentColor.sc5,
alignment: Alignment.centerLeft,
height: 80.rpx,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
child: Text(
"日期.取消".tr,
child: Padding(
padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
child: Text(
"日期.取消".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
),
onTap: () {
Get.back();
},
),
Text(
"$title",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
fontSize:
AppConstants().title_text_fontSize),
),
onTap: () {
Get.back();
},
),
Text(
"$title",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize:
AppConstants().title_text_fontSize),
),
// closeIconWhite,
InkWell(
child: Text(
"日期.确定".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
),
onTap: () {
checkChange?.call(DateTime(years[yearIndex],
months[monthIndex], days[dayIndex]));
Get.back();
},
)
],
// closeIconWhite,
InkWell(
child: Text(
"日期.确定".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc2,
letterSpacing: 0,
fontSize: AppConstants()
.normal_text_fontSize),
),
onTap: () {
checkChange?.call(DateTime(years[yearIndex],
months[monthIndex], days[dayIndex]));
Get.back();
},
)
],
),
),
),
Container(
height: 240.rpx,
margin: EdgeInsets.only(top: 60.rpx, bottom: 60.rpx),
padding: EdgeInsets.only(left: 30.rpx, right: 30.rpx),
child: Container(
child: Row(
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(
left: 40.rpx, right: 30.rpx),
padding: EdgeInsets.symmetric(horizontal: 30.rpx),
child: Row(
mainAxisAlignment: MainAxisAlignment.center, // ✅ 整体居中
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
SizedBox(
width: 120.rpx,
child: getOnePicker(context, years, yearIndex,
(d) {
yearIndex = d;
@@ -147,26 +154,18 @@ Future showDateSelectionDialog(BuildContext context,
.day;
days_select.value =
days.sublist(0, day_len);
}),
}, "".tr),
),
),
Container(
child: Text(
"",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx),
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
left: 30.rpx, right: 30.rpx),
],
),
SizedBox(width: 100.rpx),
// 月
Row(
children: [
SizedBox(
width: 80.rpx,
child: getOnePicker(
context, months, monthIndex, (d) {
monthIndex = d;
@@ -182,58 +181,29 @@ Future showDateSelectionDialog(BuildContext context,
.day;
days_select.value =
days.sublist(0, day_len);
}, "".tr),
),
],
),
SizedBox(width: 100.rpx),
Row(
children: [
SizedBox(
width: 80.rpx,
child: Obx(() {
return getOnePicker(
context, days_select, dayIndex, (d) {
dayIndex = d;
}, "".tr);
}),
),
),
Container(
child: Text(
"",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx),
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
left: 30.rpx, right: 40.rpx),
child: Obx(
() {
// print("${dayIndex} ${day_len}");
return getOnePicker(
context,
days_select,
dayIndex,
(d) {
dayIndex = d;
},
);
},
),
),
),
Container(
child: Text(
"",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color:
themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx),
),
),
],
),
],
),
],
),
),
)
],
),
),
@@ -246,9 +216,20 @@ Future showDateSelectionDialog(BuildContext context,
);
}
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
TextStyle _unitStyle(BuildContext context) {
return FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
letterSpacing: 0,
);
}
getOnePicker(BuildContext context, List arr, int checkIndex,
Function onSelectedItemChanged, String unit,
{bool looping = false}) {
ThemeController themeController = Get.find();
return CupertinoPicker(
key: UniqueKey(),
useMagnifier: false,
@@ -258,24 +239,22 @@ getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
squeeze: 1,
looping: looping,
scrollController: FixedExtentScrollController(initialItem: checkIndex),
selectionOverlay: Container(),
selectionOverlay: Container(), // 不要默认选中遮罩
onSelectedItemChanged: (int value) {
// print("$value");
onSelectedItemChanged.call(value);
},
children: [
...List.generate(arr.length, (index) {
return Container(
alignment: Alignment.center,
width: 400.rpx,
child: Text("${arr[index]}",
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx)),
);
})
],
children: List.generate(arr.length, (index) {
return Container(
alignment: Alignment.center,
child: Text(
"${arr[index]}$unit", // ✅ 每项都带单位
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
fontSize: 30.rpx,
),
),
);
}),
);
}