Skip to content

Commit

Permalink
修复学期结束导致的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinaGamer committed Jan 17, 2022
1 parent 76b16af commit 95e573e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/common/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ initTodaySchedule() async {
final String _week = writeData["week"].toString();
Map _schedule = schedule;
List toDay = [];
if (int.parse(_week) < 21)
await _schedule[_week][DateTime.now().weekday.toString()].forEach((key, value) => {
if (value[1] != "null")
{
Expand Down
10 changes: 6 additions & 4 deletions lib/pages/schedule.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:core';

import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -126,13 +127,11 @@ class SchedulePageState extends State<SchedulePage> with AutomaticKeepAliveClien
double sY = _startPositionY;
if (eY - sY < minValue || eY + sY < minValue) {
if (sX - eX > minValue) {
if (_currentScheduleWeek == 20) {
_warning1();
} else {

print("下一页");
_currentScheduleWeek++;
_findNewSchedule();
}

} else if (eX - sX > minValue) {
if (_currentScheduleWeek == 1) {
_warning1();
Expand Down Expand Up @@ -222,6 +221,9 @@ class SchedulePageColumnState extends State<SchedulePageColumn> {

@override
Widget build(BuildContext context) {
if (int.parse(_findWeek) > 20) {
_findWeek = "20";
}
return Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
Expand Down
4 changes: 3 additions & 1 deletion lib/widget/cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class HomeCardState extends State<HomeCard> with AutomaticKeepAliveClientMixin {
}

String _weekText() {
if (_week == 20) {
if (_week > 20) {
return "学期已经结束咯";
} else if (_week == 20) {
return "学期即将结束";
} else if (_week >= 15) {
return "期末来临,复习为重";
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.2.220116+13
version: 1.2.220117+14

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit 95e573e

Please sign in to comment.