master
章文轩 3 years ago
parent cc420e3b1f
commit adb48f42d7

@ -10,9 +10,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="18463f0e-cf10-4ee2-975b-376476396e12" name="Default Changelist" comment="Default Changelist"> <list default="true" id="18463f0e-cf10-4ee2-975b-376476396e12" name="Default Changelist" comment="Default Changelist">
<change beforePath="$PROJECT_DIR$/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.lock" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.lock" afterDir="false" /> <change beforePath="$PROJECT_DIR$/lib/model/date_model.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/model/date_model.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/lib/utils/lunar_util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/utils/lunar_util.dart" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -36,6 +36,7 @@
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="android.sdk.path" value="$PROJECT_DIR$/../Library/Android/sdk" /> <property name="android.sdk.path" value="$PROJECT_DIR$/../Library/Android/sdk" />
<property name="dart.analysis.tool.window.force.activate" value="false" /> <property name="dart.analysis.tool.window.force.activate" value="false" />
<property name="dart.analysis.tool.window.visible" value="false" />
<property name="io.flutter.reload.alreadyRun" value="true" /> <property name="io.flutter.reload.alreadyRun" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="flutter.settings" /> <property name="settings.editor.selected.configurable" value="flutter.settings" />
@ -90,22 +91,4 @@
</option> </option>
<option name="oldMeFiltersMigrated" value="true" /> <option name="oldMeFiltersMigrated" value="true" />
</component> </component>
<component name="WindowStateProjectService">
<state width="1858" height="156" key="GridCell.Tab.0.bottom" timestamp="1595297133366">
<screen x="-310" y="-1417" width="2560" height="1417" />
</state>
<state width="1858" height="156" key="GridCell.Tab.0.bottom/47.23.1393.877/-310.-1417.2560.1417@-310.-1417.2560.1417" timestamp="1595297133366" />
<state width="1858" height="156" key="GridCell.Tab.0.center" timestamp="1595297133366">
<screen x="-310" y="-1417" width="2560" height="1417" />
</state>
<state width="1858" height="156" key="GridCell.Tab.0.center/47.23.1393.877/-310.-1417.2560.1417@-310.-1417.2560.1417" timestamp="1595297133366" />
<state width="1858" height="156" key="GridCell.Tab.0.left" timestamp="1595297133365">
<screen x="-310" y="-1417" width="2560" height="1417" />
</state>
<state width="1858" height="156" key="GridCell.Tab.0.left/47.23.1393.877/-310.-1417.2560.1417@-310.-1417.2560.1417" timestamp="1595297133365" />
<state width="1858" height="156" key="GridCell.Tab.0.right" timestamp="1595297133366">
<screen x="-310" y="-1417" width="2560" height="1417" />
</state>
<state width="1858" height="156" key="GridCell.Tab.0.right/47.23.1393.877/-310.-1417.2560.1417@-310.-1417.2560.1417" timestamp="1595297133366" />
</component>
</project> </project>

@ -9,7 +9,7 @@ class DateModel {
int? month; int? month;
int day = 1; int day = 1;
List<int?> lunar = []; List<int> lunar = [];
// List<int> get lunar { // List<int> get lunar {
// if (lunar?.isNotEmpty == false) { // if (lunar?.isNotEmpty == false) {
@ -86,7 +86,7 @@ class DateModel {
..year = dateTime.year ..year = dateTime.year
..month = dateTime.month ..month = dateTime.month
..day = dateTime.day; ..day = dateTime.day;
List<int?> lunar = List<int> lunar =
LunarUtil.solarToLunar(dateModel.year!, dateModel.month!, dateModel.day); LunarUtil.solarToLunar(dateModel.year!, dateModel.month!, dateModel.day);
dateModel.lunar = lunar; dateModel.lunar = lunar;

@ -764,7 +764,7 @@ class LunarUtil {
// dateModel.isLeapYear = DateUtil.isLeapYear(year); // dateModel.isLeapYear = DateUtil.isLeapYear(year);
// dateModel.isCurrentDay = DateUtil.isCurrentDay(year, month, day); // dateModel.isCurrentDay = DateUtil.isCurrentDay(year, month, day);
List<int?> lunar = LunarUtil.solarToLunar(2020, 2, day); List<int> lunar = LunarUtil.solarToLunar(2020, 2, day);
// dateModel.lunarYear = (lunar[0]); // dateModel.lunarYear = (lunar[0]);
// dateModel.lunarMonth = (lunar[1]); // dateModel.lunarMonth = (lunar[1]);
@ -808,8 +808,8 @@ class LunarUtil {
* @param day * @param day
* @return [0] [1] [2] [3] 0 false : 1 true * @return [0] [1] [2] [3] 0 false : 1 true
*/ */
static List<int?> solarToLunar(int year, int month, int day) { static List<int> solarToLunar(int year, int month, int day) {
List<int?> lunarInt = []; List<int> lunarInt = [0,0,0,0];
int index = year - SOLAR[0]; int index = year - SOLAR[0];
int data = (year << 9) | (month << 5) | (day); int data = (year << 9) | (month << 5) | (day);
int solar11; int solar11;
@ -861,12 +861,12 @@ class LunarUtil {
static int solarToInt(int y, int m, int d) { static int solarToInt(int y, int m, int d) {
m = (m + 9) % 12; m = (m + 9) % 12;
y = y - (m / 10).toInt(); y = y - m ~/ 10;
return (365 * y + return (365 * y +
(y / 4).toInt() - y ~/ 4 -
(y / 100).toInt() + y ~/ 100 +
(y / 400).toInt() + y ~/ 400 +
((m * 306 + 5) / 10).toInt() + (m * 306 + 5) ~/ 10 +
(d - 1)); (d - 1));
} }

Loading…
Cancel
Save