|
...
|
...
|
@@ -1115,226 +1115,258 @@ class DialogUtil { |
|
|
|
builder: (BuildContext context) {
|
|
|
|
BuildContext dialogContext = context;
|
|
|
|
Widget widget = StatefulBuilder(builder: (context, _setState) {
|
|
|
|
return Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
TableCalendar(
|
|
|
|
calendarController: _calendarController,
|
|
|
|
initialSelectedDay: selectDateTime,
|
|
|
|
onDaySelected: (day, events, holidays) {
|
|
|
|
Navigator.of(dialogContext).pop(day);
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
TableCalendar(
|
|
|
|
calendarController: _calendarController,
|
|
|
|
initialSelectedDay: selectDateTime,
|
|
|
|
onDaySelected: (day, events, holidays) {
|
|
|
|
Navigator.of(dialogContext).pop(day);
|
|
|
|
},
|
|
|
|
// holidays: _holidays,
|
|
|
|
availableGestures: AvailableGestures.none,
|
|
|
|
events: _events,
|
|
|
|
locale: "zh_CN",
|
|
|
|
initialCalendarFormat: CalendarFormat.month,
|
|
|
|
headerStyle: HeaderStyle(
|
|
|
|
decoration:
|
|
|
|
BoxDecoration(color: MyColours.color_2bb5b7),
|
|
|
|
headerPadding: EdgeInsets.zero,
|
|
|
|
formatButtonVisible: false,
|
|
|
|
centerHeaderTitle: false,
|
|
|
|
titleTextBuilder: (dateTime, _) {
|
|
|
|
return dateTime.year.toString() +
|
|
|
|
"年-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"月";
|
|
|
|
},
|
|
|
|
// holidays: _holidays,
|
|
|
|
availableGestures: AvailableGestures.none,
|
|
|
|
events: _events,
|
|
|
|
locale: "zh_CN",
|
|
|
|
initialCalendarFormat: CalendarFormat.month,
|
|
|
|
headerStyle: HeaderStyle(
|
|
|
|
decoration:
|
|
|
|
BoxDecoration(color: MyColours.color_2bb5b7),
|
|
|
|
headerPadding: EdgeInsets.zero,
|
|
|
|
formatButtonVisible: false,
|
|
|
|
centerHeaderTitle: false,
|
|
|
|
titleTextBuilder: (dateTime, _) {
|
|
|
|
return dateTime.year.toString() +
|
|
|
|
"年-" +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
"月";
|
|
|
|
},
|
|
|
|
titleTextStyle: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
leftChevronIcon: const Icon(Icons.chevron_left,
|
|
|
|
color: Colors.white),
|
|
|
|
rightChevronIcon: const Icon(Icons.chevron_right,
|
|
|
|
color: Colors.white),
|
|
|
|
),
|
|
|
|
calendarStyle: CalendarStyle(
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(bottom: ScreenUtil().setWidth(8)),
|
|
|
|
weekdayStyle: TextStyle(
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
weekendStyle: TextStyle(
|
|
|
|
color: MyColours.color_f49a5e,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
selectedColor: MyColours.color_2bb5b7,
|
|
|
|
outsideDaysVisible: false,
|
|
|
|
),
|
|
|
|
builders: CalendarBuilders(
|
|
|
|
dowWeekdayBuilder: (context, weekday) {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(40)),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setHeight(25)),
|
|
|
|
child: Text(
|
|
|
|
weekday,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_97e9ea,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
height: ScreenUtil().setWidth(200),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
titleTextStyle: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
leftChevronIcon:
|
|
|
|
const Icon(Icons.chevron_left, color: Colors.white),
|
|
|
|
rightChevronIcon: const Icon(Icons.chevron_right,
|
|
|
|
color: Colors.white),
|
|
|
|
),
|
|
|
|
calendarStyle: CalendarStyle(
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(bottom: ScreenUtil().setWidth(8)),
|
|
|
|
weekdayStyle: TextStyle(
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
weekendStyle: TextStyle(
|
|
|
|
color: MyColours.color_f49a5e,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
selectedColor: MyColours.color_2bb5b7,
|
|
|
|
outsideDaysVisible: false,
|
|
|
|
),
|
|
|
|
builders: CalendarBuilders(
|
|
|
|
dowWeekdayBuilder: (context, weekday) {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(40)),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setHeight(25)),
|
|
|
|
child: Text(
|
|
|
|
weekday,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_97e9ea,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
height: ScreenUtil().setWidth(200),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
// color: Colors.blue,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(8),
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(16),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${date.day}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_353535),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
selectedDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
// color: Colors.blue,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(8),
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(16),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${date.day}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_353535),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
selectedDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
color: MyColours.color_2bb5b7),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(8),
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(16),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${date.day}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_ffffff),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
todayDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
width: ScreenUtil().setWidth(2))),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(8),
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(16),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
// '今',
|
|
|
|
'${date.day}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_2bb5b7),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(8),
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(16),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${date.day}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_ffffff),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
todayDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
width: ScreenUtil().setWidth(2))),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(12),
|
|
|
|
ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(8),
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(16),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
// '今',
|
|
|
|
'${date.day}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_2bb5b7),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
markersBuilder: (context, date, events, holidays) {
|
|
|
|
final children = <Widget>[];
|
|
|
|
|
|
|
|
// if (events.isNotEmpty) {
|
|
|
|
// children.add(
|
|
|
|
// Positioned(
|
|
|
|
// right: 1,
|
|
|
|
// bottom: 1,
|
|
|
|
// child: _buildEventsMarker(date, events),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (holidays.isNotEmpty) {
|
|
|
|
children.add(
|
|
|
|
Positioned(
|
|
|
|
right: ScreenUtil().setWidth(27),
|
|
|
|
bottom: 0,
|
|
|
|
top: ScreenUtil().setWidth(30),
|
|
|
|
child: buildMarker(date)),
|
|
|
|
// Align(
|
|
|
|
// alignment: Alignment.bottomCenter,
|
|
|
|
// child: buildMarker(date),
|
|
|
|
// )
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
markersBuilder: (context, date, events, holidays) {
|
|
|
|
final children = <Widget>[];
|
|
|
|
|
|
|
|
return children;
|
|
|
|
},
|
|
|
|
// singleMarkerBuilder: (context, dateTime, event) {
|
|
|
|
// return Container(
|
|
|
|
// width: ScreenUtil().setWidth(6),
|
|
|
|
// height: ScreenUtil().setWidth(6),
|
|
|
|
// margin:
|
|
|
|
// const EdgeInsets.symmetric(horizontal: 0.3),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// shape: BoxShape.circle,
|
|
|
|
// color: MyColours.color_ff0000,
|
|
|
|
// if (events.isNotEmpty) {
|
|
|
|
// children.add(
|
|
|
|
// Positioned(
|
|
|
|
// right: 1,
|
|
|
|
// bottom: 1,
|
|
|
|
// child: _buildEventsMarker(date, events),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
right: ScreenUtil().setWidth(62),
|
|
|
|
bottom: ScreenUtil().setHeight(20),
|
|
|
|
child: Container(
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
_calendarController.setSelectedDay(DateTime.now());
|
|
|
|
_setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: ClipOval(
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil().setWidth(100),
|
|
|
|
height: ScreenUtil().setWidth(100),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
color: MyColours.color_2bb5b7,
|
|
|
|
child: Text(
|
|
|
|
"回到\n今天",
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (holidays.isNotEmpty) {
|
|
|
|
children.add(
|
|
|
|
Positioned(
|
|
|
|
right: ScreenUtil().setWidth(27),
|
|
|
|
bottom: 0,
|
|
|
|
top: ScreenUtil().setWidth(30),
|
|
|
|
child: buildMarker(date)),
|
|
|
|
// Align(
|
|
|
|
// alignment: Alignment.bottomCenter,
|
|
|
|
// child: buildMarker(date),
|
|
|
|
// )
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
|
|
|
|
return children;
|
|
|
|
},
|
|
|
|
// singleMarkerBuilder: (context, dateTime, event) {
|
|
|
|
// return Container(
|
|
|
|
// width: ScreenUtil().setWidth(6),
|
|
|
|
// height: ScreenUtil().setWidth(6),
|
|
|
|
// margin:
|
|
|
|
// const EdgeInsets.symmetric(horizontal: 0.3),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// shape: BoxShape.circle,
|
|
|
|
// color: MyColours.color_ff0000,
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
_calendarController.setSelectedDay(DateTime.now());
|
|
|
|
_setState(() {});
|
|
|
|
},
|
|
|
|
text: '回到今天',
|
|
|
|
fontSize: 28,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(70),
|
|
|
|
width: ScreenUtil().setWidth(220),
|
|
|
|
gradientStart: MyColours.color_2bb5b7,
|
|
|
|
gradientEnd: MyColours.color_2bb5b7,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
),
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
text: '取消',
|
|
|
|
fontSize: 28,
|
|
|
|
isBold: false,
|
|
|
|
textColor: MyColours.color_333333,
|
|
|
|
borderColor: Color.fromRGBO(119, 119, 119, 1),
|
|
|
|
height: ScreenUtil().setWidth(70),
|
|
|
|
width: ScreenUtil().setWidth(220),
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
|
|
|
|
// Positioned(
|
|
|
|
// right: ScreenUtil().setWidth(62),
|
|
|
|
// bottom: ScreenUtil().setHeight(20),
|
|
|
|
// child: Container(
|
|
|
|
// child: GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
// _calendarController.setSelectedDay(DateTime.now());
|
|
|
|
// _setState(() {});
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// child: ClipOval(
|
|
|
|
// child: Container(
|
|
|
|
// width: ScreenUtil().setWidth(100),
|
|
|
|
// height: ScreenUtil().setWidth(100),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// color: MyColours.color_2bb5b7,
|
|
|
|
// child: Text(
|
|
|
|
// "回到\n今天",
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_ffffff,
|
|
|
|
// fontSize: ScreenUtil().setSp(26)),
|
|
|
|
// ),
|
|
|
|
// )),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
);
|
|
|
|
});
|
|
|
|
return SizedBox(
|
|
|
|
width: double.infinity,
|
...
|
...
|
|