人员资料生日数据格式错误
This commit is contained in:
@@ -271,6 +271,153 @@ Future showDateSelectionDialog(BuildContext context,
|
||||
);
|
||||
}
|
||||
|
||||
// Future showMonthSelectionDialog(
|
||||
// BuildContext context, {
|
||||
// required DateTime checkDate,
|
||||
// Function(DateTime)? checkChange,
|
||||
// String title = "选择月份",
|
||||
// }) {
|
||||
// ThemeController themeController = Get.find();
|
||||
|
||||
// final List<int> years = List.generate(100, (i) => DateTime.now().year - i)
|
||||
// ..sort();
|
||||
// final List<int> months = List.generate(12, (i) => i + 1);
|
||||
|
||||
// final RxInt yearIndex = years.indexOf(checkDate.year).obs;
|
||||
// final RxInt monthIndex = months.indexOf(checkDate.month).obs;
|
||||
|
||||
// return showDialog(
|
||||
// context: context,
|
||||
// barrierDismissible: true,
|
||||
// builder: (BuildContext context) {
|
||||
// return Stack(
|
||||
// children: [
|
||||
// Positioned(
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// right: 0,
|
||||
// child: Material(
|
||||
// color: Colors.transparent,
|
||||
// child: Dialog(
|
||||
// backgroundColor: const Color(0xFF003058),
|
||||
// insetPadding: EdgeInsets.zero,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(0),
|
||||
// ),
|
||||
// child: Container(
|
||||
// width: double.infinity,
|
||||
// padding: EdgeInsets.fromLTRB(30.rpx, 10.rpx, 30.rpx, 90.rpx),
|
||||
// child: Column(
|
||||
// mainAxisSize: MainAxisSize.min,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
// children: <Widget>[
|
||||
// Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.transparent,
|
||||
// padding: EdgeInsets.zero,
|
||||
// onTap: () => Navigator.of(context).pop(),
|
||||
// child: Container(
|
||||
// width: 100.rpx,
|
||||
// height: 60.rpx,
|
||||
// alignment: Alignment.center,
|
||||
// child: Text("取消",
|
||||
// style: TextStyle(
|
||||
// fontSize: 30.rpx, color: Colors.white)),
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// title,
|
||||
// style: TextStyle(
|
||||
// fontFamily: 'Readex Pro',
|
||||
// color: themeController.currentColor.sc3,
|
||||
// fontSize: 30.rpx,
|
||||
// ),
|
||||
// ),
|
||||
// ClickableContainer(
|
||||
// backgroundColor: Colors.transparent,
|
||||
// highlightColor: Colors.transparent,
|
||||
// padding: EdgeInsets.zero,
|
||||
// onTap: () {
|
||||
// final selectedDate = DateTime(
|
||||
// years[yearIndex.value],
|
||||
// months[monthIndex.value],
|
||||
// );
|
||||
// Navigator.of(context).pop();
|
||||
// checkChange?.call(selectedDate);
|
||||
// },
|
||||
// child: Container(
|
||||
// width: 100.rpx,
|
||||
// height: 60.rpx,
|
||||
// alignment: Alignment.center,
|
||||
// child: Text("确定",
|
||||
// style: TextStyle(
|
||||
// fontSize: 30.rpx,
|
||||
// color: stringToColor("#84F5FF"))),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// SizedBox(height: 20.rpx),
|
||||
// Stack(
|
||||
// children: [
|
||||
// Positioned.fill(
|
||||
// child: IgnorePointer(
|
||||
// child: Center(
|
||||
// child: Container(
|
||||
// height: 90.rpx,
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
// decoration: BoxDecoration(
|
||||
// color: const Color(0xFF84F5FF),
|
||||
// borderRadius: BorderRadius.circular(16.rpx),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 240.rpx,
|
||||
// child: Padding(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 95.rpx),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: getOnePickers(
|
||||
// context,
|
||||
// years,
|
||||
// yearIndex,
|
||||
// unit: "年",
|
||||
// ),
|
||||
// ),
|
||||
// Expanded(
|
||||
// child: getOnePickers(
|
||||
// context,
|
||||
// months,
|
||||
// monthIndex,
|
||||
// unit: "月",
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
Future showMonthSelectionDialog(
|
||||
BuildContext context, {
|
||||
required DateTime checkDate,
|
||||
@@ -279,12 +426,42 @@ Future showMonthSelectionDialog(
|
||||
}) {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
final currentYear = DateTime.now().year;
|
||||
final currentMonth = DateTime.now().month;
|
||||
|
||||
final List<int> years = List.generate(100, (i) => DateTime.now().year - i)
|
||||
..sort();
|
||||
final List<int> months = List.generate(12, (i) => i + 1);
|
||||
|
||||
final RxInt yearIndex = years.indexOf(checkDate.year).obs;
|
||||
final RxInt monthIndex = months.indexOf(checkDate.month).obs;
|
||||
final RxList<int> months = <int>[].obs;
|
||||
|
||||
// 初始化 yearIndex
|
||||
final int initYearIndex = years.indexOf(checkDate.year);
|
||||
final RxInt yearIndex = (initYearIndex >= 0 ? initYearIndex : 0).obs;
|
||||
|
||||
final RxInt monthIndex = 0.obs;
|
||||
|
||||
bool isInit = true;
|
||||
|
||||
void updateMonthList() {
|
||||
final selectedYear = years[yearIndex.value];
|
||||
final maxMonth = selectedYear == currentYear ? currentMonth : 12;
|
||||
final newMonths = List.generate(maxMonth, (i) => i + 1);
|
||||
months.value = newMonths;
|
||||
|
||||
if (isInit) {
|
||||
final int newMonthIndex = newMonths.indexOf(checkDate.month);
|
||||
monthIndex.value = newMonthIndex >= 0 ? newMonthIndex : 0;
|
||||
isInit = false;
|
||||
} else {
|
||||
if (monthIndex.value >= newMonths.length) {
|
||||
monthIndex.value = newMonths.length - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateMonthList();
|
||||
|
||||
ever(yearIndex, (_) => updateMonthList());
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
@@ -311,6 +488,7 @@ Future showMonthSelectionDialog(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
// 顶部标题与按钮
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -323,9 +501,13 @@ Future showMonthSelectionDialog(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text("取消",
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx, color: Colors.white)),
|
||||
child: Text(
|
||||
"取消",
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -352,15 +534,19 @@ Future showMonthSelectionDialog(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
child: Text("确定",
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: stringToColor("#84F5FF"))),
|
||||
child: Text(
|
||||
"确定",
|
||||
style: TextStyle(
|
||||
fontSize: 30.rpx,
|
||||
color: stringToColor("#84F5FF"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20.rpx),
|
||||
// 中间选中高亮背景
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
@@ -378,6 +564,7 @@ Future showMonthSelectionDialog(
|
||||
),
|
||||
),
|
||||
),
|
||||
// 滚轮选择器
|
||||
SizedBox(
|
||||
height: 240.rpx,
|
||||
child: Padding(
|
||||
@@ -395,7 +582,7 @@ Future showMonthSelectionDialog(
|
||||
Expanded(
|
||||
child: getOnePickers(
|
||||
context,
|
||||
months,
|
||||
months, // 注意这里取 .value
|
||||
monthIndex,
|
||||
unit: "月",
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user