Commit 61df77a12c0bfbbd6a5d968afa2931d09d78d514

Authored by wdn127929
1 parent e1bd456d

修改日历

... ... @@ -11,14 +11,14 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = "316"
def flutterVersionCode = "317"
if (flutterVersionCode == null) {
flutterVersionCode = '316'
flutterVersionCode = '317'
}
def flutterVersionName = "3.1.6"
def flutterVersionName = "3.1.7"
if (flutterVersionName == null) {
flutterVersionName = '3.1.6'
flutterVersionName = '3.1.7'
}
apply plugin: 'com.android.application'
... ...
... ... @@ -193,8 +193,7 @@ class _EditReserverPageState extends State<EditReserverPage> {
VEmptyView(40),
Expanded(
child: Column(
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
... ... @@ -365,300 +364,307 @@ class _EditReserverPageState extends State<EditReserverPage> {
),
],
),
Stack(
children: [
Container(
height: ScreenUtil().setWidth(180),
width: double.infinity,
color: MyColours.color_ffffff,
),
Offstage(
offstage: !(showPhoneHistory &&
detailModel.userHistorys.length > 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.white),
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_e5e5e5,
blurRadius:
ScreenUtil().setWidth(20))
]),
width: ScreenUtil().setWidth(440),
height: detailModel.userHistorys.length > 1
? ScreenUtil().setWidth(180)
: ScreenUtil().setWidth(104),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: Align(
alignment: Alignment.topCenter,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView.builder(
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
showPhoneHistory = false;
detailModel.phoneController
.text = detailModel
.userHistorys[
index]
.phone !=
null
? detailModel
.userHistorys[index]
.phone
: '';
// _homeEnterModel.nameController.text =
// _homeEnterModel
// .userHistorys[index].rname +
// _nameSuffix();
_addNameSuffix(
detailModel
],
),
VEmptyView(60),
Stack(
children: [
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(60)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
text: '返回',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_ffffff,
textColor: MyColours.color_333333,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_ffffff,
onPressed: () {
// setState(() {
// nameStr = '';
// detailModel.nameController.text = '';
// detailModel.phoneController.text = '';
// });
Navigator.of(context).pop();
},
),
widget.needBtn
? RoundButton(
text: '保存并发短信',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(200),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_199095,
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
onPressed: () async {
if (nameStr == null ||
nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text
.trim()
.length ==
0) {
Utils.showToast('请填写电话');
return;
}
if (!Utils.phoneRegExp(detailModel
.phoneController.text)) {
Utils.showToast('手机号错误,请修改正确');
return;
}
String sex = '1';
for (var item
in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess =
await detailModel.upReserveInfo(
context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel
.phoneController.text,
showLoading: true);
if (sucess) {
bus.emit(
"refresh_tablemanager"); //刷新桌位
bus.emit(
"refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
UserModel userModel =
Provider.of<UserModel>(
context,
listen: false);
Map<String, String> params = {
"rid": widget.rid,
"sid": userModel.user.sellerid
};
CouponProvider couponProvider =
Provider.of<CouponProvider>(
context,
listen: false);
bool success =
await couponProvider
.sendSMSWxSendSms(
context, params);
print(success);
if (success) {
Navigator.of(context).pop(
detailModel
.phoneController.text);
}
}
},
)
: SizedBox(),
RoundButton(
text: widget.needBtn ? '仅保存' : '保存',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: widget.needBtn
? MyColours.color_ffffff
: MyColours.color_199095,
gradientEnd: widget.needBtn
? MyColours.color_ffffff
: MyColours.color_199095,
textColor: widget.needBtn
? MyColours.color_333333
: MyColours.color_ffffff,
borderColor: MyColours.color_199095,
onPressed: () async {
if (nameStr == null ||
nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text
.trim()
.length ==
0) {
Utils.showToast('请填写电话');
return;
}
if (!Utils.phoneRegExp(
detailModel.phoneController.text)) {
Utils.showToast('手机号错误,请修改正确');
return;
}
String sex = '1';
for (var item in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess = await detailModel
.upReserveInfo(context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel
.phoneController.text);
if (sucess) {
EventBus().emit(
"refresh_tablemanager"); //刷新桌位
bus.emit("refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
Navigator.of(context).pop(
detailModel.phoneController.text);
}
},
)
],
)),
Offstage(
offstage: !(showPhoneHistory &&
detailModel.userHistorys.length > 0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
border: Border.all(color: Colors.white),
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
color: MyColours.color_e5e5e5,
blurRadius: ScreenUtil().setWidth(20))
]),
width: ScreenUtil().setWidth(440),
height: detailModel.userHistorys.length > 1
? ScreenUtil().setWidth(260)
: ScreenUtil().setWidth(104),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(30)),
child: Align(
alignment: Alignment.topCenter,
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView.builder(
shrinkWrap: true,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
showPhoneHistory = false;
detailModel.phoneController
.text = detailModel
.userHistorys[index]
.rname,
_nameSuffix());
nameStr = detailModel
.phone !=
null
? detailModel
.userHistorys[index]
.rname;
_phoneNode.unfocus();
detailModel.userHistorys
.clear();
});
},
child: Container(
width: double.infinity,
height: ScreenUtil()
.setWidth(102),
decoration: BoxDecoration(
border: Border(
bottom: (index !=
(detailModel
.userHistorys
.length -
1) &&
detailModel
.phone
: '';
// _homeEnterModel.nameController.text =
// _homeEnterModel
// .userHistorys[index].rname +
// _nameSuffix();
_addNameSuffix(
detailModel
.userHistorys[index]
.rname,
_nameSuffix());
nameStr = detailModel
.userHistorys[index].rname;
_phoneNode.unfocus();
detailModel.userHistorys
.clear();
});
},
child: Container(
width: double.infinity,
height:
ScreenUtil().setWidth(102),
decoration: BoxDecoration(
border: Border(
bottom: (index !=
(detailModel
.userHistorys
.length >
1)
? BorderSide(
color: MyColours
.color_e5e5e5,
width: ScreenUtil()
.length -
1) &&
detailModel
.userHistorys
.length >
1)
? BorderSide(
color: MyColours
.color_e5e5e5,
width:
ScreenUtil()
.setWidth(
2))
: BorderSide
.none)),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
detailModel
: BorderSide.none)),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Text(
detailModel
.userHistorys[
index]
.phone ==
null
? ''
: detailModel
.userHistorys[index]
.phone,
style: TextStyle(
color: MyColours
.color_333333,
fontSize:
ScreenUtil()
.setSp(32)),
),
Expanded(
child: Text(
detailModel
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(32)),
),
Expanded(
child: Text(
detailModel
.userHistorys[
index]
.rname ==
null
? ''
: detailModel
.userHistorys[index]
.rname,
style: TextStyle(
color: MyColours
.color_333333,
fontSize:
ScreenUtil()
.setSp(32)),
))
],
),
),
);
},
itemExtent:
ScreenUtil().setWidth(104),
itemCount:
detailModel.userHistorys.length,
))),
),
)
],
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(32)),
))
],
),
),
);
},
itemExtent: ScreenUtil().setWidth(104),
itemCount:
detailModel.userHistorys.length,
))),
),
),
],
)),
Padding(
padding:
EdgeInsets.only(top: ScreenUtil().setWidth(60)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
text: '返回',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_ffffff,
textColor: MyColours.color_333333,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_ffffff,
onPressed: () {
// setState(() {
// nameStr = '';
// detailModel.nameController.text = '';
// detailModel.phoneController.text = '';
// });
Navigator.of(context).pop();
},
),
widget.needBtn
? RoundButton(
text: '保存并发短信',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(200),
radius: ScreenUtil().setWidth(10),
gradientStart: MyColours.color_199095,
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
onPressed: () async {
if (nameStr == null ||
nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text
.trim()
.length ==
0) {
Utils.showToast('请填写电话');
return;
}
if (!Utils.phoneRegExp(
detailModel.phoneController.text)) {
Utils.showToast('手机号错误,请修改正确');
return;
}
String sex = '1';
for (var item in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess = await detailModel
.upReserveInfo(context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel
.phoneController.text,
showLoading: true);
if (sucess) {
bus.emit(
"refresh_tablemanager"); //刷新桌位
bus.emit(
"refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
UserModel userModel =
Provider.of<UserModel>(context,
listen: false);
Map<String, String> params = {
"rid": widget.rid,
"sid": userModel.user.sellerid
};
CouponProvider couponProvider =
Provider.of<CouponProvider>(
context,
listen: false);
bool success = await couponProvider
.sendSMSWxSendSms(
context, params);
print(success);
if (success) {
Navigator.of(context).pop(
detailModel
.phoneController.text);
}
}
},
)
: SizedBox(),
RoundButton(
text: widget.needBtn ? '仅保存' : '保存',
fontSize: 28,
isBold: false,
height: ScreenUtil().setWidth(70),
width: ScreenUtil().setWidth(180),
radius: ScreenUtil().setWidth(10),
gradientStart: widget.needBtn
? MyColours.color_ffffff
: MyColours.color_199095,
gradientEnd: widget.needBtn
? MyColours.color_ffffff
: MyColours.color_199095,
textColor: widget.needBtn
? MyColours.color_333333
: MyColours.color_ffffff,
borderColor: MyColours.color_199095,
onPressed: () async {
if (nameStr == null ||
nameStr.trim().length == 0) {
Utils.showToast('请填写客人姓名');
return;
}
if (detailModel.phoneController.text
.trim()
.length ==
0) {
Utils.showToast('请填写电话');
return;
}
if (!Utils.phoneRegExp(
detailModel.phoneController.text)) {
Utils.showToast('手机号错误,请修改正确');
return;
}
String sex = '1';
for (var item in detailModel.sexList) {
if (item['select']) {
sex = item['code'];
}
}
bool sucess = await detailModel.upReserveInfo(
context, widget.rid,
name: nameStr,
sex: sex,
phone: detailModel.phoneController.text);
if (sucess) {
EventBus()
.emit("refresh_tablemanager"); //刷新桌位
bus.emit("refresh_book_list"); //刷新已预订列表
bus.emit("refresh_detail");
Navigator.of(context)
.pop(detailModel.phoneController.text);
}
},
)
],
)),
VEmptyView(40)
),
])))));
}
}
... ...
This diff could not be displayed because it is too large.
... ... @@ -102,10 +102,10 @@ class NotebookDetailChangeModel with ChangeNotifier {
// getReserveList(context, needLoading: false);
}
_returnDate(DateTime day) {
String time = Utils.lunarCalendarHolidays(day);
_returnDate(DateTime day) {
// String time = Utils.lunarCalendarHolidays(day);
String date = _returnDayDateWeek(day);
date += ' ${time}';
// date += ' ${time}';
return date;
}
... ...
... ... @@ -1274,7 +1274,7 @@ class DialogUtil {
} else if (Utils.isOneDay(dateTime, now.add(Duration(days: 2)))) {
return "后";
} else {
return dateTime.day.toString();
return '${Utils.lunarCalendarHolidaysShow(dateTime)}';
}
}
... ... @@ -1301,227 +1301,302 @@ class DialogUtil {
BuildContext dialogContext = context;
Widget widget = StatefulBuilder(builder: (context, _setState) {
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) +
"月";
},
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: 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>[];
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
TableCalendar(
// rowHeight: ScreenUtil().setWidth(100),
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) +
"月";
},
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 (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),
// )
);
// }
// 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),
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,
// ),
// );
// },
),
),
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),
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: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(10),
)
],
)
],
)
],
)
))
// Positioned(
// right: ScreenUtil().setWidth(62),
... ... @@ -1551,7 +1626,7 @@ class DialogUtil {
// ),
// )
// ],
);
;
});
return SizedBox(
width: double.infinity,
... ...
... ... @@ -11,6 +11,22 @@ class LunarCalendar {
bool leap;
///中文月名称
static List<String> chineseNumberShow = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"冬月",
"腊月"
];
///中文月名称
static List<String> chineseNumber = [
"一",
"二",
... ... @@ -276,6 +292,10 @@ class LunarCalendar {
return chineseNumber[month - 1];
}
String getChinaMonthStringShow() {
return chineseNumberShow[month - 1];
}
String toString() {
return "$year" +
"年" +
... ...
... ... @@ -28,8 +28,520 @@ import 'package:webview_flutter/webview_flutter.dart';
import '../app.dart';
typedef BookTimeSetCallback = void Function(bool needChange);
const int START_YEAR = 1901;
const int END_YEAR = 2050;
class Utils {
static List gLunarHolDay = [
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1901
0X96, 0XA4, 0X96, 0X96, 0X97, 0X87, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1902
0X96, 0XA5, 0X87, 0X96, 0X87, 0X87, 0X79, 0X69, 0X69, 0X69, 0X78,
0X78, //1903
0X86, 0XA5, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X78,
0X87, //1904
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1905
0X96, 0XA4, 0X96, 0X96, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1906
0X96, 0XA5, 0X87, 0X96, 0X87, 0X87, 0X79, 0X69, 0X69, 0X69, 0X78,
0X78, //1907
0X86, 0XA5, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1908
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1909
0X96, 0XA4, 0X96, 0X96, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1910
0X96, 0XA5, 0X87, 0X96, 0X87, 0X87, 0X79, 0X69, 0X69, 0X69, 0X78,
0X78, //1911
0X86, 0XA5, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1912
0X95, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1913
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1914
0X96, 0XA5, 0X97, 0X96, 0X97, 0X87, 0X79, 0X79, 0X69, 0X69, 0X78,
0X78, //1915
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1916
0X95, 0XB4, 0X96, 0XA6, 0X96, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X87, //1917
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X77, //1918
0X96, 0XA5, 0X97, 0X96, 0X97, 0X87, 0X79, 0X79, 0X69, 0X69, 0X78,
0X78, //1919
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1920
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X87, //1921
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X77, //1922
0X96, 0XA4, 0X96, 0X96, 0X97, 0X87, 0X79, 0X79, 0X69, 0X69, 0X78,
0X78, //1923
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1924
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X87, //1925
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1926
0X96, 0XA4, 0X96, 0X96, 0X97, 0X87, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1927
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1928
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1929
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1930
0X96, 0XA4, 0X96, 0X96, 0X97, 0X87, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1931
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1932
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1933
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1934
0X96, 0XA4, 0X96, 0X96, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1935
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1936
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1937
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1938
0X96, 0XA4, 0X96, 0X96, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1939
0X96, 0XA5, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1940
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1941
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1942
0X96, 0XA4, 0X96, 0X96, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1943
0X96, 0XA5, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1944
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1945
0X95, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X77, //1946
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1947
0X96, 0XA5, 0XA6, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //1948
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X79, 0X78, 0X79, 0X77,
0X87, //1949
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X77, //1950
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X79, 0X79, 0X79, 0X69, 0X78,
0X78, //1951
0X96, 0XA5, 0XA6, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //1952
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1953
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X78, 0X79, 0X78, 0X68, 0X78,
0X87, //1954
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1955
0X96, 0XA5, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //1956
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1957
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1958
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1959
0X96, 0XA4, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1960
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1961
0X96, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1962
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1963
0X96, 0XA4, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1964
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1965
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1966
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1967
0X96, 0XA4, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1968
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1969
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1970
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X79, 0X69, 0X78,
0X77, //1971
0X96, 0XA4, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1972
0XA5, 0XB5, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1973
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1974
0X96, 0XB4, 0X96, 0XA6, 0X97, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X77, //1975
0X96, 0XA4, 0XA5, 0XB5, 0XA6, 0XA6, 0X88, 0X89, 0X88, 0X78, 0X87,
0X87, //1976
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //1977
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X78,
0X87, //1978
0X96, 0XB4, 0X96, 0XA6, 0X96, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X77, //1979
0X96, 0XA4, 0XA5, 0XB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1980
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X77,
0X87, //1981
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1982
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X78, 0X79, 0X78, 0X69, 0X78,
0X77, //1983
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X87, //1984
0XA5, 0XB4, 0XA6, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //1985
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1986
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X79, 0X78, 0X69, 0X78,
0X87, //1987
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //1988
0XA5, 0XB4, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1989
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //1990
0X95, 0XB4, 0X96, 0XA5, 0X86, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1991
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //1992
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1993
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1994
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X76, 0X78, 0X69, 0X78,
0X87, //1995
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //1996
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //1997
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //1998
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //1999
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //2000
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2001
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //2002
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //2003
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //2004
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2005
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2006
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X69, 0X78,
0X87, //2007
0X96, 0XB4, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X87, 0X78, 0X87,
0X86, //2008
0XA5, 0XB3, 0XA5, 0XB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2009
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2010
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X78,
0X87, //2011
0X96, 0XB4, 0XA5, 0XB5, 0XA5, 0XA6, 0X87, 0X88, 0X87, 0X78, 0X87,
0X86, //2012
0XA5, 0XB3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X87, //2013
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2014
0X95, 0XB4, 0X96, 0XA5, 0X96, 0X97, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //2015
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X87, 0X88, 0X87, 0X78, 0X87,
0X86, //2016
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X87, //2017
0XA5, 0XB4, 0XA6, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2018
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //2019
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X86, //2020
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //2021
0XA5, 0XB4, 0XA5, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2022
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X79, 0X77,
0X87, //2023
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X96, //2024
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //2025
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2026
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //2027
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X96, //2028
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //2029
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2030
0XA5, 0XB4, 0X96, 0XA5, 0X96, 0X96, 0X88, 0X78, 0X78, 0X78, 0X87,
0X87, //2031
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X96, //2032
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X86, //2033
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X78, 0X88, 0X78, 0X87,
0X87, //2034
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2035
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X96, //2036
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X86, //2037
0XA5, 0XB3, 0XA5, 0XA5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2038
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2039
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X96, //2040
0XA5, 0XC3, 0XA5, 0XB5, 0XA5, 0XA6, 0X87, 0X88, 0X87, 0X78, 0X87,
0X86, //2041
0XA5, 0XB3, 0XA5, 0XB5, 0XA6, 0XA6, 0X88, 0X88, 0X88, 0X78, 0X87,
0X87, //2042
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2043
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X88, 0X87,
0X96, //2044
0XA5, 0XC3, 0XA5, 0XB4, 0XA5, 0XA6, 0X87, 0X88, 0X87, 0X78, 0X87,
0X86, //2045
0XA5, 0XB3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X88, 0X78, 0X87,
0X87, //2046
0XA5, 0XB4, 0X96, 0XA5, 0XA6, 0X96, 0X88, 0X88, 0X78, 0X78, 0X87,
0X87, //2047
0X95, 0XB4, 0XA5, 0XB4, 0XA5, 0XA5, 0X97, 0X87, 0X87, 0X88, 0X86,
0X96, //2048
0XA4, 0XC3, 0XA5, 0XA5, 0XA5, 0XA6, 0X97, 0X87, 0X87, 0X78, 0X87,
0X86, //2049
0XA5, 0XC3, 0XA5, 0XB5, 0XA6, 0XA6, 0X87, 0X88, 0X78, 0X78, 0X87,
0X87 //2050
];
static String getLunarSpecialDate(DateTime dateTime) {
String _day = '';
int iYear = dateTime.year;
int iMonth = dateTime.month;
int iDay = dateTime.day;
List chineseDays = [
"小寒",
"大寒",
"立春",
"雨水",
"惊蛰",
"春分",
"清明",
"谷雨",
"立夏",
"小满",
"芒种",
"夏至",
"小暑",
"大暑",
"立秋",
"处暑",
"白露",
"秋分",
"寒露",
"霜降",
"立冬",
"小雪",
"大雪",
"冬至"
];
int array_index = (iYear - START_YEAR) * 12 + iMonth - 1;
int flag = gLunarHolDay[array_index];
int day;
if (iDay < 15)
day = 15 - ((flag >> 4) & 0x0f);
else
day = ((flag) & 0x0f) + 15;
int index = -1;
if (iDay == day) {
index = (iMonth - 1) * 2 + (iDay > 15 ? 1 : 0);
}
if (index >= 0 && index < chineseDays.length) {
_day = chineseDays[index];
return _day;
} else {
return '';
}
}
static String lunarCalendarUtils(DateTime day) {
LunarCalendar lunarCalendar = LunarCalendar(day);
String time =
... ... @@ -37,6 +549,68 @@ class Utils {
return time;
}
static String lunarCalendarUtilsShow(DateTime day) {
LunarCalendar lunarCalendar = LunarCalendar(day);
if (lunarCalendar.day == 1) {
return lunarCalendar.getChinaMonthStringShow();
}
// String time =
// '${lunarCalendar.getChinaMonthString()}月${LunarCalendar.getChinaDayString(lunarCalendar.day)}';
return LunarCalendar.getChinaDayString(lunarCalendar.day);
}
//农历节日 *表示放假日 日历上面使用
static String lunarCalendarHolidaysShow(DateTime day) {
LunarCalendar lunarCalendar = LunarCalendar(day);
//阴历月-日
String keyLunar =
addZeroNumber(lunarCalendar.month) + addZeroNumber(lunarCalendar.day);
//阳历月-日
String keySolar =
Utils.addZeroNumber(day.month) + Utils.addZeroNumber(day.day);
Map<String, String> holiday1 = {
"0101": "春节",
"0102": "大年初二",
"0103": "大年初三",
"0104": "大年初四",
"0105": "大年初五",
"0106": "大年初六",
"0107": "大年初七",
"0115": "元宵节",
"0505": "端午节",
"0707": "七夕情人节",
"0815": "中秋节",
"0909": "重阳节",
"1208": "腊八节",
"1223": "过小年",
"0100": "除夕"
};
// Map<String, String> holiday2 = {
// "0101": '元旦',
// "0214": "情人节",
// "0308": "妇女节",
// "0501": "劳动节",
// "0504": "青年节",
// "0601": "国际儿童节",
// "0801": "八一建军节",
// "0910": "教师节",
// "1001": "国庆节",
// "1224": "平安夜",
// "1225": "圣诞节",
// };
if (holiday1.containsKey(keyLunar)) {
return holiday1[keyLunar];
}
String jieqi = getLunarSpecialDate(day);
if (jieqi != '') {
return jieqi;
}
// if (holiday2.containsKey(keySolar)) {
// return holiday2[keySolar];
// }
return lunarCalendarUtilsShow(day);
}
//农历节日 *表示放假日
static String lunarCalendarHolidays(DateTime day) {
LunarCalendar lunarCalendar = LunarCalendar(day);
... ...