fix null bug

master
章文轩 2 years ago
parent adb48f42d7
commit 31de633004

@ -10,9 +10,7 @@
</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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/lib/utils/solar_term_util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/utils/solar_term_util.dart" 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$/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" />

@ -2001,7 +2001,7 @@ class SolarTermUtil {
*/ */
static List<double> earCal(double jd) { static List<double> earCal(double jd) {
EnnT = jd / 365250; EnnT = jd / 365250;
List<double> llr = []; List<double> llr = [0,0,0];
double t1 = EnnT, t2 = t1 * t1, t3 = t2 * t1, t4 = t3 * t1, t5 = t4 * t1; double t1 = EnnT, t2 = t1 * t1, t3 = t2 * t1, t4 = t3 * t1, t5 = t4 * t1;
llr[0] = Enn(E10) + llr[0] = Enn(E10) +
Enn(E11) * t1 + Enn(E11) * t1 +
@ -2045,7 +2045,7 @@ class SolarTermUtil {
static List<double?> moonCoord(double julian) { static List<double?> moonCoord(double julian) {
MnnT = julian / 36525; MnnT = julian / 36525;
double t1 = MnnT, t2 = t1 * t1, t3 = t2 * t1, t4 = t3 * t1; double t1 = MnnT, t2 = t1 * t1, t3 = t2 * t1, t4 = t3 * t1;
List<double?> llr = []; List<double?> llr = [0,0,0];
llr[0] = (Mnn(M10) + Mnn(M11) * t1 + Mnn(M12) * t2) / SECOND_PER_RAD; llr[0] = (Mnn(M10) + Mnn(M11) * t1 + Mnn(M12) * t2) / SECOND_PER_RAD;
llr[1] = (Mnn(M20) + Mnn(M21) * t1) / SECOND_PER_RAD; llr[1] = (Mnn(M20) + Mnn(M21) * t1) / SECOND_PER_RAD;
llr[2] = (Mnn(M30) + Mnn(M31) * t1) * 0.999999949827; llr[2] = (Mnn(M30) + Mnn(M31) * t1) * 0.999999949827;
@ -2125,6 +2125,9 @@ class SolarTermUtil {
static List<String?> getSolarTerms(int year) { static List<String?> getSolarTerms(int year) {
List<String?> solarTerms = []; List<String?> solarTerms = [];
for(int i=0;i<24;i++){
solarTerms.add('');
}
List<String?> preOffset = getSolarTermsPreOffset(year - 1); List<String?> preOffset = getSolarTermsPreOffset(year - 1);
List<String?> nextOffset = getSolarTermsNextOffset(year - 1); List<String?> nextOffset = getSolarTermsNextOffset(year - 1);
System.arraycopy(preOffset, 0, solarTerms, 0, preOffset.length); System.arraycopy(preOffset, 0, solarTerms, 0, preOffset.length);
@ -2148,7 +2151,7 @@ class SolarTermUtil {
* @return * @return
*/ */
static List<String?> getSolarTermsPreOffset(int year) { static List<String?> getSolarTermsPreOffset(int year) {
List<String?> solarTerms = []; List<String?> solarTerms = ['','',''];
double jd = 365.2422 * (year - 2000), q; double jd = 365.2422 * (year - 2000), q;
for (int i = 21; i < 24; i++) { for (int i = 21; i < 24; i++) {
q = getTimeFromAngle(jd + i * 15.2, i * 15.toDouble(), 0); q = getTimeFromAngle(jd + i * 15.2, i * 15.toDouble(), 0);
@ -2166,7 +2169,7 @@ class SolarTermUtil {
* @return * @return
*/ */
static List<String?> getSolarTermsNextOffset(int year) { static List<String?> getSolarTermsNextOffset(int year) {
List<String?> solarTerms = []; List<String?> solarTerms = ['',''];
double jd = 365.2422 * (year - 2000), q; double jd = 365.2422 * (year - 2000), q;
for (int i = 19; i < 21; i++) { for (int i = 19; i < 21; i++) {
q = getTimeFromAngle(jd + i * 15.2, i * 15.toDouble(), 0); q = getTimeFromAngle(jd + i * 15.2, i * 15.toDouble(), 0);

Loading…
Cancel
Save