Skip to content

Commit

Permalink
feat: bump dart version to 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
abc873693 committed Oct 25, 2024
1 parent 21d0ff6 commit 6703322
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 29 deletions.
5 changes: 2 additions & 3 deletions lib/api/selcrs_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class SelcrsHelper {
GeneralResponse(statusCode: 401, message: 'need to fill out form'),
) as Future<GeneralResponse>;
} else {
return dumpError('course', text, callback) as Future<GeneralResponse?>;
return dumpError('course', text, callback)! as Future<GeneralResponse?>;
}
} on DioException catch (e) {
if (e.type == DioExceptionType.badResponse &&
Expand Down Expand Up @@ -226,7 +226,7 @@ class SelcrsHelper {
);
}
if (!canReLogin) {
return dumpError('getUserInfo', text, callback) as Future<UserInfo?>;
return dumpError('getUserInfo', text, callback)! as Future<UserInfo?>;
}
reLoginCount = 0;
if (callback == null) {
Expand Down Expand Up @@ -357,7 +357,6 @@ class SelcrsHelper {
switch (Locale(Intl.defaultLocale!).languageCode) {
case 'en':
title = titles[1];
break;
case 'zh':
default:
title = titles[0];
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/bus/bus_list_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
10 changes: 4 additions & 6 deletions lib/pages/bus/bus_time_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/comfirm_form_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/graduation_report_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -375,21 +375,18 @@ class HomePageState extends State<HomePage> {
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;
}
});
}
Expand Down
4 changes: 0 additions & 4 deletions lib/pages/study/course_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,12 @@ class CoursePageState extends State<CoursePage> {
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')) {
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/tuition_and_fees_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/user_info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions lib/widgets/share_data_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6703322

Please sign in to comment.