Skip to content

Commit

Permalink
v1.1.6-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Aquarian-Age committed Dec 9, 2022
1 parent e93d89f commit a939cb1
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 15 deletions.
3 changes: 2 additions & 1 deletion calendar_todo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ flutter build apk --obfuscate --split-debug-info=build --release --build-name=1.
1. 日干支
2. 日建除
3. 二十八宿(日禽)
4. 宗教节日

# 待修正

1. 阳历日期节日滚动显示不完整
2.
2. 宗教节日显示到页面底部

![calendar](./calendar.png)

Binary file added calendar_todo/calendar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions calendar_todo/lib/day.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class TitleDay extends StatelessWidget {
}

class DayBox extends StatelessWidget {
final String zongJiao;
final double font;
final double screenWidth;
final DateTime date;
final bool showNoteIcon;
Expand All @@ -46,6 +48,8 @@ class DayBox extends StatelessWidget {
final Function(DateTime, bool) onSelectCallback;

DayBox(
this.zongJiao,
this.font,
this.date,
this.screenWidth, {
this.showNoteIcon = false,
Expand Down Expand Up @@ -78,7 +82,7 @@ class DayBox extends StatelessWidget {
height: screenWidth / 8 / 3, //阴历节日高度位置
child: MarqueeWidget(
text: str,
textStyle: TextStyle(fontSize: 12, color: Colors.redAccent),
textStyle: TextStyle(fontSize: font, color: Colors.redAccent),
scrollAxis: Axis.horizontal,
ratioOfBlankToScreen: 0.05,
),
Expand Down Expand Up @@ -111,7 +115,7 @@ class DayBox extends StatelessWidget {
stackChildren.add(
Container(
alignment: Alignment.center,
child: Text("${date.day}", style: TextStyle(fontSize: screenWidth / 25, color: Colors.black)),
child: Text("${date.day}", style: TextStyle(fontSize: font, color: Colors.black)), //screenWidth / 25
),
);

Expand All @@ -132,7 +136,7 @@ class DayBox extends StatelessWidget {
},
child: Container(
width: screenWidth / 8,
height: screenWidth / 6.6, //8// 日历子部件高度
height: screenWidth / 7, //8// 日历子部件高度
child: Stack(children: stackChildren),
),
);
Expand Down
33 changes: 22 additions & 11 deletions calendar_todo/lib/month_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';

import 'package:calendar_todo/zong_jiao_jie_ri.dart';
import 'package:event_bus/event_bus.dart';
// import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -149,13 +151,17 @@ class MonthViewState extends State<MonthView> {
EventBus _eventBus = EventBus();
StreamSubscription subscription;

double font = 18; //PC端默认字体大小
@override
initState() {
super.initState();
subscription = _eventBus.on<DateTime>().listen((DateTime newDt) {
widget._setShowDate(newDt);
setState(() {});
});

///Android默认字体大小
Platform.isAndroid ? font = _width / 30 : font;
}

@override
Expand Down Expand Up @@ -184,6 +190,7 @@ class MonthViewState extends State<MonthView> {
return _list;
}

String moonName = ''; //宗教节日
void _prepareNoteStr(LunarMonth lunarMonth, _MonthInfo monthInfo, int day, List<TextSpan> lunarStrs, List<TextSpan> gregorianStrs) {
if (null == lunarMonth) {
return;
Expand All @@ -195,30 +202,34 @@ class MonthViewState extends State<MonthView> {
///二十八宿(日禽)
String riqin = lunarMonth.GetRiQin(lunarDayInfo.weekday, lunarDayInfo.gzDay);

///阴历月日
moonName = "${lunarDayInfo.lunarMonthName}${lunarDayInfo.lunarDayName}";
moonName = zjjr[moonName];

//农历信息+
lunarStrs.clear();
if (1 == lunarDayInfo.lunarDay) {
//农历月份
lunarStrs.addAll([
TextSpan(text: lunarDayInfo.lunarMonthName, style: TextStyle(color: Colors.orange, fontSize: 12)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: 12)),
TextSpan(text: lunarDayInfo.lunarMonthName, style: TextStyle(color: Colors.orange, fontSize: font)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: font)),
]);
lunarStrs.addAll([
TextSpan(text: "", style: TextStyle(color: Colors.grey)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: 12)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: font)),
]);
}

//农历日期
lunarStrs.addAll([
TextSpan(text: lunarDayInfo.lunarDayName + " " + riqin, style: TextStyle(color: Colors.indigo, fontSize: 14)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: 12)),
TextSpan(text: lunarDayInfo.lunarDayName + " " + riqin, style: TextStyle(color: Colors.indigo, fontSize: font)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: font)),
]);

if ("" != lunarDayInfo.lunarFestival) {
lunarStrs.addAll([
TextSpan(text: "", style: TextStyle(color: Colors.grey)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: 12)),
TextSpan(text: "", style: TextStyle(color: Colors.black, fontSize: font)),
]);
//农历节日
lunarStrs.addAll([
Expand Down Expand Up @@ -250,8 +261,8 @@ class MonthViewState extends State<MonthView> {
}
//节气
gregorianStrs.addAll([
TextSpan(text: lunarDayInfo.jieqi, style: TextStyle(color: Colors.red, fontSize: 12)),
TextSpan(text: " ", style: TextStyle(color: Colors.grey, fontSize: 12)),
TextSpan(text: lunarDayInfo.jieqi, style: TextStyle(color: Colors.red, fontSize: font)),
TextSpan(text: " ", style: TextStyle(color: Colors.grey, fontSize: font)),
]);
}

Expand All @@ -264,8 +275,8 @@ class MonthViewState extends State<MonthView> {
///添加日干支
if (lunarDayInfo.jieqi == "") {
gregorianStrs.addAll([
TextSpan(text: lunarDayInfo.gzDay, style: TextStyle(color: Colors.lightBlueAccent, fontSize: 14)),
TextSpan(text: jianchu, style: TextStyle(color: Colors.black38, fontSize: 14)),
TextSpan(text: lunarDayInfo.gzDay, style: TextStyle(color: Colors.lightBlueAccent, fontSize: font)),
TextSpan(text: jianchu, style: TextStyle(color: Colors.black38, fontSize: font)),
]);
}

Expand Down Expand Up @@ -303,7 +314,7 @@ class MonthViewState extends State<MonthView> {
List<TextSpan> lunarStrs = [], gregorianStrs = [];
_prepareNoteStr(lunarMonth, monthInfo, day, lunarStrs, gregorianStrs);

days.add(DayBox(date, _width,
days.add(DayBox(moonName, font, date, _width,
// showNoteIcon: (noteIconType != NoteIconType.none),
// noteActive: (noteIconType == NoteIconType.colorful),
selected: selected,
Expand Down
Loading

0 comments on commit a939cb1

Please sign in to comment.