更新
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user