|
...
|
...
|
@@ -422,11 +422,25 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
// }
|
|
|
|
|
|
|
|
dateTimeNow = day;
|
|
|
|
Duration days = day!.difference(DateTime.now());
|
|
|
|
|
|
|
|
DateTime nowDay = (DateTime.parse((dateTimeNow!.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTimeNow!.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTimeNow!.day) +
|
|
|
|
" 00:00:00")));
|
|
|
|
DateTime startDay = (DateTime.parse((DateTime.now().year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(DateTime.now().month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(DateTime.now().day) +
|
|
|
|
" 00:00:00")));
|
|
|
|
Duration days = nowDay.difference(startDay);
|
|
|
|
print(days);
|
|
|
|
|
|
|
|
/// _focusedDay
|
|
|
|
if ((days.inDays == 0) || (days.inDays > 0 && days.inDays < 7)) {
|
|
|
|
if ((days.inDays == 0 ) ||
|
|
|
|
(days.inDays > 0 && days.inDays <7)) {
|
|
|
|
// _calendarController.setSelectedDay(day);
|
|
|
|
dateText = '更多\n日期';
|
|
|
|
clearSel = false;
|
|
...
|
...
|
@@ -434,7 +448,7 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
} else {
|
|
|
|
clearSel = true;
|
|
|
|
// dateText = '${day.year}年\n${day.month}月\n${day.day}日';
|
|
|
|
dateText = '${day.month}月\n${day.day}日';
|
|
|
|
dateText = '${day!.month}月\n${day.day}日';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
...
|
...
|
@@ -704,8 +718,8 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(24),
|
|
|
|
),
|
|
|
|
left: ScreenUtil().setWidth(20),
|
|
|
|
right: ScreenUtil().setWidth(20)),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
...
|
...
|
@@ -715,13 +729,15 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
lastDay: DateTime(2050),
|
|
|
|
focusedDay: _focusedDay!,
|
|
|
|
currentDay: DateTime.now(),
|
|
|
|
rowHeight: ScreenUtil().setWidth(74 * 2),
|
|
|
|
rowHeight: ScreenUtil().setWidth(40 * 2),
|
|
|
|
// calendarController: _calendarController,
|
|
|
|
// initialSelectedDay: dateTimeNow,
|
|
|
|
headerVisible: false,
|
|
|
|
// daysOfWeekHeight: w(10),
|
|
|
|
startingDayOfWeek: startingDayOfWeek,
|
|
|
|
selectedDayPredicate: (day) =>
|
|
|
|
isSameDay(dateTimeNow!, day),
|
|
|
|
selectedDayPredicate: (day) => clearSel
|
|
|
|
? false
|
|
|
|
: isSameDay(dateTimeNow!, day),
|
|
|
|
// startDay: DateTime.now(),
|
|
|
|
// endDay: DateTime.now().add(Duration(days: 5)),
|
|
|
|
onDaySelected: (
|
|
...
|
...
|
@@ -746,6 +762,14 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
locale: "zh_CN",
|
|
|
|
calendarFormat: CalendarFormat.week,
|
|
|
|
calendarStyle: CalendarStyle(
|
|
|
|
outsideTextStyle: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
cellMargin: EdgeInsets.zero,
|
|
|
|
cellPadding: EdgeInsets.zero
|
|
|
|
|
|
|
|
// renderDaysOfWeek: false,
|
|
|
|
// defaultTextStyle: TextStyle(
|
|
|
|
// color: MyColours.color_515151,
|
|
...
|
...
|
@@ -781,251 +805,168 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
// color: MyColours.font_color_333333),
|
|
|
|
),
|
|
|
|
calendarBuilders: CalendarBuilders(
|
|
|
|
dowBuilder: (context, date) {
|
|
|
|
return SizedBox();
|
|
|
|
dowBuilder: (context, day) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
if (!Utils.isOneDay(
|
|
|
|
day, dateTimeNow!)) {
|
|
|
|
//不是一天
|
|
|
|
dateTimeNow = day;
|
|
|
|
_focusedDay = dateTimeNow;
|
|
|
|
clearSel = false;
|
|
|
|
setState(() {
|
|
|
|
dateText = '更多\n日期';
|
|
|
|
});
|
|
|
|
ddateSoltSelect =
|
|
|
|
currTimeIndex.toString();
|
|
|
|
getMealSectionByDay(needInit: false);
|
|
|
|
|
|
|
|
_reserveCountDay();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
DateTime.now().weekday ==
|
|
|
|
day.weekday
|
|
|
|
? '今日'
|
|
|
|
: Utils.formatWeekDayNum(
|
|
|
|
day.weekday),
|
|
|
|
style: TextStyle(
|
|
|
|
color: dateTimeNow!.weekday ==
|
|
|
|
day.weekday &&
|
|
|
|
!clearSel
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_BFC4D4,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28)),
|
|
|
|
)));
|
|
|
|
},
|
|
|
|
defaultBuilder: (context, dateTime, date2) {
|
|
|
|
return Column(children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(16)),
|
|
|
|
child: Text(
|
|
|
|
DateTime.now().weekday ==
|
|
|
|
dateTime.weekday
|
|
|
|
? '今日'
|
|
|
|
: Utils.formatWeekDayNum(
|
|
|
|
dateTime.weekday),
|
|
|
|
style: TextStyle(
|
|
|
|
color: dateTimeNow!.weekday ==
|
|
|
|
dateTime.weekday &&
|
|
|
|
!clearSel
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_BFC4D4,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
dateTime.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
disabledBuilder: (context, dateTime, events) {
|
|
|
|
return Container(
|
|
|
|
// width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(8)),
|
|
|
|
padding: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(4),
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
// margin: EdgeInsets.all(
|
|
|
|
// ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
dateTime.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
outsideBuilder: (context, day, focusedDay) {
|
|
|
|
return Container(
|
|
|
|
// width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// shape: BoxShape.circle,
|
|
|
|
// ),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
// margin: EdgeInsets.all(
|
|
|
|
// ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
day.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
disabledBuilder: (context, dateTime, events) {
|
|
|
|
return Container(
|
|
|
|
// width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// shape: BoxShape.circle,
|
|
|
|
// ),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
// margin: EdgeInsets.all(
|
|
|
|
// ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
dateTime.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_999999),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
// weekNumberBuilder: (context, weekday) {
|
|
|
|
// return Container(
|
|
|
|
// color: MyColours.color_ffffff,
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// vertical: ScreenUtil().setWidth(16)),
|
|
|
|
// child: Text(
|
|
|
|
// "周${Utils.formatWeekDayNum(DateTime.now().weekday)}" ==
|
|
|
|
// weekday
|
|
|
|
// ? '今日'
|
|
|
|
// : weekday.toString(),
|
|
|
|
// style: TextStyle(
|
|
|
|
// color:
|
|
|
|
// "周${Utils.formatWeekDayNum(dateTimeNow!.weekday)}" ==
|
|
|
|
// weekday &&
|
|
|
|
// !clearSel
|
|
|
|
// ? MyColours.color_438E93
|
|
|
|
// : MyColours.color_BFC4D4,
|
|
|
|
// fontSize: ScreenUtil().setSp(28)),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
|
|
|
|
selectedBuilder: (context, date, _) {
|
|
|
|
return clearSel
|
|
|
|
? Column(children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical:
|
|
|
|
ScreenUtil().setWidth(16)),
|
|
|
|
child: Text(
|
|
|
|
DateTime.now().weekday ==
|
|
|
|
date.weekday
|
|
|
|
? '今日'
|
|
|
|
: Utils.formatWeekDayNum(
|
|
|
|
date.weekday),
|
|
|
|
style: TextStyle(
|
|
|
|
color: dateTimeNow!.weekday ==
|
|
|
|
date.weekday &&
|
|
|
|
!clearSel
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_BFC4D4,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width:
|
|
|
|
ScreenUtil().setWidth(28 * 2),
|
|
|
|
height:
|
|
|
|
ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
date.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
])
|
|
|
|
: Column(children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical:
|
|
|
|
ScreenUtil().setWidth(16)),
|
|
|
|
child: Text(
|
|
|
|
DateTime.now().weekday ==
|
|
|
|
date.weekday
|
|
|
|
? '今日'
|
|
|
|
: Utils.formatWeekDayNum(
|
|
|
|
date.weekday),
|
|
|
|
style: TextStyle(
|
|
|
|
color: dateTimeNow!.weekday ==
|
|
|
|
date.weekday &&
|
|
|
|
!clearSel
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_BFC4D4,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width:
|
|
|
|
ScreenUtil().setWidth(28 * 2),
|
|
|
|
height:
|
|
|
|
ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
gradient: LinearGradient(
|
|
|
|
colors: [
|
|
|
|
MyColours.color_438E93,
|
|
|
|
MyColours.color_438E93
|
|
|
|
],
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
end: Alignment.bottomCenter),
|
|
|
|
// border: Border.all(color: MyColours.color_FFB116)
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(8)),
|
|
|
|
padding: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(4),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
date.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
todayBuilder: (context, dateTime, _) {
|
|
|
|
return Column(children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(16)),
|
|
|
|
child: Text(
|
|
|
|
DateTime.now().weekday ==
|
|
|
|
dateTime.weekday
|
|
|
|
? '今日'
|
|
|
|
: Utils.formatWeekDayNum(
|
|
|
|
dateTime.weekday),
|
|
|
|
style: TextStyle(
|
|
|
|
color: dateTimeNow!.weekday ==
|
|
|
|
dateTime.weekday &&
|
|
|
|
!clearSel
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_BFC4D4,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
return Container(
|
|
|
|
// width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
gradient: clearSel
|
|
|
|
? null
|
|
|
|
: LinearGradient(
|
|
|
|
colors: [
|
|
|
|
MyColours.color_438E93,
|
|
|
|
MyColours.color_438E93
|
|
|
|
],
|
|
|
|
begin: Alignment.topCenter,
|
|
|
|
end: Alignment.bottomCenter),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
// margin: EdgeInsets.all(
|
|
|
|
// ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
date.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: clearSel
|
|
|
|
? MyColours.color_515151
|
|
|
|
: MyColours.color_ffffff,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
dateTime.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
singleMarkerBuilder:
|
|
|
|
(context, dateTime, event) {
|
|
|
|
todayBuilder: (context, dateTime, _) {
|
|
|
|
return Container(
|
|
|
|
width: ScreenUtil().setWidth(6),
|
|
|
|
height: ScreenUtil().setWidth(6),
|
|
|
|
margin: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 0.3),
|
|
|
|
// width: ScreenUtil().setWidth(28 * 2),
|
|
|
|
height: ScreenUtil().setWidth(28 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
color: MyColours.color_ff0000,
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
// margin: EdgeInsets.all(
|
|
|
|
// ScreenUtil().setWidth(8)),
|
|
|
|
child: Text(
|
|
|
|
dateTime.day.toString(),
|
|
|
|
style: TextStyle().copyWith(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
// 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,
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
))),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
...
|
...
|
|