diff --git a/lib/api/selcrs_helper.dart b/lib/api/selcrs_helper.dart index c09855c..5c376bb 100644 --- a/lib/api/selcrs_helper.dart +++ b/lib/api/selcrs_helper.dart @@ -169,7 +169,7 @@ class SelcrsHelper { GeneralResponse(statusCode: 401, message: 'need to fill out form'), ) as Future; } else { - return dumpError('course', text, callback) as Future; + return dumpError('course', text, callback)! as Future; } } on DioException catch (e) { if (e.type == DioExceptionType.badResponse && @@ -226,7 +226,7 @@ class SelcrsHelper { ); } if (!canReLogin) { - return dumpError('getUserInfo', text, callback) as Future; + return dumpError('getUserInfo', text, callback)! as Future; } reLoginCount = 0; if (callback == null) { @@ -357,7 +357,6 @@ class SelcrsHelper { switch (Locale(Intl.defaultLocale!).languageCode) { case 'en': title = titles[1]; - break; case 'zh': default: title = titles[0]; diff --git a/lib/pages/bus/bus_list_page.dart b/lib/pages/bus/bus_list_page.dart index 0018ff4..2da737a 100644 --- a/lib/pages/bus/bus_list_page.dart +++ b/lib/pages/bus/bus_list_page.dart @@ -13,9 +13,9 @@ class BusListPage extends StatefulWidget { final Locale locale; const BusListPage({ - Key? key, + super.key, required this.locale, - }) : super(key: key); + }); @override _BusListPageState createState() => _BusListPageState(); diff --git a/lib/pages/bus/bus_time_page.dart b/lib/pages/bus/bus_time_page.dart index fe7a447..e248c58 100644 --- a/lib/pages/bus/bus_time_page.dart +++ b/lib/pages/bus/bus_time_page.dart @@ -14,10 +14,10 @@ class BusTimePage extends StatefulWidget { final BusInfo busInfo; const BusTimePage({ - Key? key, + super.key, required this.busInfo, required this.locale, - }) : super(key: key); + }); @override _BusTimePageState createState() => _BusTimePageState(); @@ -166,10 +166,10 @@ class BusTimeItem extends StatelessWidget { final Locale locale; const BusTimeItem({ - Key? key, + super.key, required this.busTime, required this.locale, - }) : super(key: key); + }); @override Widget build(BuildContext context) { @@ -188,14 +188,12 @@ class BusTimeItem extends StatelessWidget { arrivedTimeText = 'Arriving'; } color = Colors.red; - break; case '將到站': if (isEnglish) { arrivedTimeText = 'Coming\nSoon'; fontSize = 12.0; } color = Colors.green; - break; default: break; } diff --git a/lib/pages/comfirm_form_page.dart b/lib/pages/comfirm_form_page.dart index 77204a0..cf36fbc 100644 --- a/lib/pages/comfirm_form_page.dart +++ b/lib/pages/comfirm_form_page.dart @@ -13,10 +13,10 @@ class ConfirmFormPage extends StatefulWidget { final String username; const ConfirmFormPage({ - Key? key, + super.key, required this.confirmFormUrl, required this.username, - }) : super(key: key); + }); @override _ConfirmFormPageState createState() => _ConfirmFormPageState(); diff --git a/lib/pages/graduation_report_page.dart b/lib/pages/graduation_report_page.dart index 0f2a4bc..ef3ffca 100644 --- a/lib/pages/graduation_report_page.dart +++ b/lib/pages/graduation_report_page.dart @@ -10,7 +10,7 @@ enum _State { loading, finish, error, empty, offlineEmpty } class GraduationReportPage extends StatefulWidget { static const String routerName = '/graduationReport'; - const GraduationReportPage({Key? key}) : super(key: key); + const GraduationReportPage({super.key}); @override GraduationReportPageState createState() => GraduationReportPageState(); @@ -441,9 +441,9 @@ class BorderContainer extends StatelessWidget { final Widget child; const BorderContainer({ - Key? key, + super.key, required this.child, - }) : super(key: key); + }); @override Widget build(BuildContext context) { diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index d582b62..bbff311 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -375,21 +375,18 @@ class HomePageState extends State { locale: Locale(Intl.defaultLocale!), ), ); - break; case 1: if (isLogin) { ApUtils.pushCupertinoStyle(context, CoursePage()); } else { UiUtil.instance.showToast(context, ap.notLoginHint); } - break; case 2: if (isLogin) { ApUtils.pushCupertinoStyle(context, ScorePage()); } else { UiUtil.instance.showToast(context, ap.notLoginHint); } - break; } }); } diff --git a/lib/pages/study/course_page.dart b/lib/pages/study/course_page.dart index 6fa87ce..68d1aea 100644 --- a/lib/pages/study/course_page.dart +++ b/lib/pages/study/course_page.dart @@ -161,16 +161,12 @@ class CoursePageState extends State { switch (lastCode) { case '0': last = app.continuingSummerEducationProgram; - break; case '1': last = app.fallSemester; - break; case '2': last = app.springSemester; - break; case '3': last = app.summerSemester; - break; } String first; if (Intl.defaultLocale!.contains('en')) { diff --git a/lib/pages/tuition_and_fees_page.dart b/lib/pages/tuition_and_fees_page.dart index 8e83f91..eb340a7 100644 --- a/lib/pages/tuition_and_fees_page.dart +++ b/lib/pages/tuition_and_fees_page.dart @@ -13,7 +13,7 @@ import 'package:sprintf/sprintf.dart'; enum _State { loading, finish, error, empty } class TuitionAndFeesPage extends StatefulWidget { - const TuitionAndFeesPage({Key? key}) : super(key: key); + const TuitionAndFeesPage({super.key}); @override _TuitionAndFeesPageState createState() => _TuitionAndFeesPageState(); diff --git a/lib/pages/user_info_page.dart b/lib/pages/user_info_page.dart index 0451c9f..a37de21 100644 --- a/lib/pages/user_info_page.dart +++ b/lib/pages/user_info_page.dart @@ -6,9 +6,9 @@ class UserInfoPage extends StatefulWidget { final UserInfo userInfo; const UserInfoPage({ - Key? key, + super.key, required this.userInfo, - }) : super(key: key); + }); @override _UserInfoPageState createState() => _UserInfoPageState(); diff --git a/lib/widgets/share_data_widget.dart b/lib/widgets/share_data_widget.dart index fcf695e..2e9fa92 100644 --- a/lib/widgets/share_data_widget.dart +++ b/lib/widgets/share_data_widget.dart @@ -5,8 +5,7 @@ import 'package:nsysu_ap/app.dart'; class ShareDataWidget extends InheritedWidget { final MyAppState data; - const ShareDataWidget(this.data, {required Widget child}) - : super(child: child); + const ShareDataWidget(this.data, {required super.child}); static ShareDataWidget? of(BuildContext context) { return context.dependOnInheritedWidgetOfExactType(); diff --git a/pubspec.yaml b/pubspec.yaml index d219570..01320cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ description: NSYSU AP version: 1.4.2+10402 environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: flutter: