|
...
|
...
|
@@ -7255,6 +7255,366 @@ class DialogUtil { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//显示日历弹框
|
|
|
|
static Future<DateTime> showCalendarDialogMultiple(
|
|
|
|
BuildContext context, DateTime selectDateTime) {
|
|
|
|
CalendarController _calendarController = CalendarController();
|
|
|
|
final _selectedDay = DateTime.now();
|
|
|
|
Map<DateTime, List> _events = {
|
|
|
|
_selectedDay: ['Event A7', 'Event B7', 'Event C7', 'Event D7'],
|
|
|
|
_selectedDay.add(Duration(days: 1)): [
|
|
|
|
'Event A8',
|
|
|
|
'Event B8',
|
|
|
|
'Event C8',
|
|
|
|
'Event D8'
|
|
|
|
],
|
|
|
|
_selectedDay.add(Duration(days: 2)):
|
|
|
|
Set.from(['Event A9', 'Event A9', 'Event B9']).toList(),
|
|
|
|
};
|
|
|
|
return showModalBottomSheet<DateTime>(
|
|
|
|
context: context,
|
|
|
|
isScrollControlled: true,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
BuildContext dialogContext = context;
|
|
|
|
Widget widget = StatefulBuilder(builder: (context, _setState) {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
|
|
|
TableCalendar(
|
|
|
|
// rowHeight: ScreenUtil().setWidth(100),
|
|
|
|
calendarController: _calendarController,
|
|
|
|
initialSelectedDay: _selectedDay,
|
|
|
|
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) +
|
|
|
|
"月";
|
|
|
|
},
|
|
|
|
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(30)),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(15)),
|
|
|
|
child: Text(
|
|
|
|
weekday,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_97e9ea,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
dayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
// height: ScreenUtil().setWidth(210),
|
|
|
|
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(10)),
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// // horizontal: ScreenUtil().setWidth(12),
|
|
|
|
// vertical: ScreenUtil().setWidth(8),
|
|
|
|
// ),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${Utils.addZeroNumber(date.day)}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
color: MyColours.color_353535,
|
|
|
|
fontWeight: FontWeight.bold)),
|
|
|
|
// Text(
|
|
|
|
// // "${_parseDateDay(date)}",
|
|
|
|
// '${Utils.getLunarSpecialDate(date)}',
|
|
|
|
// style: TextStyle().copyWith(
|
|
|
|
// fontSize: ScreenUtil().setSp(22),
|
|
|
|
// color: MyColours.color_353535),
|
|
|
|
// ),
|
|
|
|
Text(
|
|
|
|
"${_parseDateDay(date)}",
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(18),
|
|
|
|
color: MyColours.color_353535),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
selectedDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// margin: EdgeInsets.fromLTRB(
|
|
|
|
// ScreenUtil().setWidth(12),
|
|
|
|
// ScreenUtil().setWidth(12),
|
|
|
|
// ScreenUtil().setWidth(12),
|
|
|
|
// ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(10),
|
|
|
|
left: ScreenUtil().setWidth(5),
|
|
|
|
right: ScreenUtil().setWidth(5),
|
|
|
|
top: ScreenUtil().setWidth(10)),
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(10)),
|
|
|
|
color: Color.fromRGBO(42, 110, 109, 1)),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${Utils.addZeroNumber(date.day)}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"${_parseDateDay(date)}",
|
|
|
|
// '${Utils.lunarCalendarHolidaysShow(date)}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(22),
|
|
|
|
color: MyColours.color_ffffff),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
todayDayBuilder: (context, date, _) {
|
|
|
|
return Container(
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// margin: EdgeInsets.fromLTRB(
|
|
|
|
// ScreenUtil().setWidth(12),
|
|
|
|
// ScreenUtil().setWidth(12),
|
|
|
|
// ScreenUtil().setWidth(12),
|
|
|
|
// ScreenUtil().setWidth(32)),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(10),
|
|
|
|
left: ScreenUtil().setWidth(5),
|
|
|
|
right: ScreenUtil().setWidth(5),
|
|
|
|
top: ScreenUtil().setWidth(10)),
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(10)),
|
|
|
|
color: MyColours.color_2bb5b7),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
// "${_parseDateDay(date)}",
|
|
|
|
'${Utils.addZeroNumber(date.day)}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"${_parseDateDay(date)}",
|
|
|
|
// '${Utils.lunarCalendarHolidaysShow(date)}',
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(22),
|
|
|
|
color: MyColours.color_ffffff),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
// 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(
|
|
|
|
// // '今',
|
|
|
|
// '${Utils.addZeroNumber(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),
|
|
|
|
// )
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
// 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,
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(4),
|
|
|
|
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: Colors.transparent,
|
|
|
|
gradientEnd: Colors.transparent,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40)
|
|
|
|
],
|
|
|
|
))
|
|
|
|
|
|
|
|
// 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,
|
|
|
|
// height: ScreenUtil().setWidth(975),
|
|
|
|
child: widget,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//显示日历弹框
|
|
|
|
static Future<DateTime> showCalendarDialog(
|
|
|
|
BuildContext context, DateTime selectDateTime) {
|
...
|
...
|
|