Skip to content

Commit

Permalink
Upgrade to Flutter v3.24.2 (#1703)
Browse files Browse the repository at this point in the history
Migrations:
* [Generic types in
PopScope](https://docs.flutter.dev/release/breaking-changes/popscope-with-result)
* [Deprecate `ButtonBar` in favor of
`OverflowBar`](https://docs.flutter.dev/release/breaking-changes/deprecate-buttonbar)
  • Loading branch information
nilsreichardt authored Sep 8, 2024
1 parent 3b7245a commit 28b529c
Show file tree
Hide file tree
Showing 670 changed files with 561 additions and 540 deletions.
2 changes: 1 addition & 1 deletion .fvmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"flutter": "3.22.2",
"flutter": "3.24.2",
"runPubGetOnSdkChanges": false,
"updateVscodeSettings": true,
"updateGitIgnore": false
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dart.flutterSdkPath": ".fvm/versions/3.22.2",
"dart.flutterSdkPath": ".fvm/versions/3.24.2",
"search.exclude": {
"**/.fvm": true
},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/account/account_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class _AccountPageState extends State<AccountPage> {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/account/profile/user_edit/user_edit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ class _UserEditPageState extends State<UserEditPage> {
Widget build(BuildContext context) {
return BlocProvider(
bloc: bloc,
child: PopScope(
child: PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ class EnterActivationCodeResultDialog {
body: LoadingEnterActivationCodeResultDialog());
}

Future<void> show(BuildContext context) {
Future<void> show(BuildContext context) async {
hideKeyboard(context: context);
final joinResultStream = enterActivationCodeBloc.enterActivationCodeResult;
final stateSheetContentStream = joinResultStream.map((joinResult) =>
mapStateSheetContentFromJoinResult(joinResult, context));
final stateSheetContentStream = joinResultStream.map((joinResult) {
if (!context.mounted) return const StateSheetContent(body: SizedBox());
return mapStateSheetContentFromJoinResult(joinResult, context);
});
final stateSheet = StateSheet(stateSheetContentStream);

return stateSheet.showSheet(context);
Expand Down
29 changes: 16 additions & 13 deletions app/lib/auth/reset_pw_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,20 @@ class _EmailField extends StatelessWidget {
onEditingComplete: () async {
final isValid = await bloc.submitValid.first;
if (isValid) {
bloc
.submit()
.then((_) => showSnack(
text: _ResetPasswordPage.erfolg,
duration: const Duration(seconds: 5),
context: context))
.catchError((e, StackTrace s) {
log('$e', error: e, stackTrace: s);
bloc.submit().then((_) {
if (!context.mounted) return;
showSnack(
text: _ResetPasswordPage.error,
text: _ResetPasswordPage.erfolg,
duration: const Duration(seconds: 5),
context: context);
}).catchError((e, s) {
log('$e', error: e, stackTrace: s);
if (!context.mounted) return;
showSnack(
text: _ResetPasswordPage.error,
duration: const Duration(seconds: 5),
context: context,
);
});
}
},
Expand Down Expand Up @@ -196,11 +198,12 @@ class _SubmitButton extends StatelessWidget {
FocusManager.instance.primaryFocus?.unfocus();
sendDataToFrankfurtSnackBar(context);
snapshot.hasData && snapshot.data == true
? bloc
.submit()
.then((_) => showConfirmationDialog(context))
.catchError((e, StackTrace s) {
? bloc.submit().then((_) {
if (!context.mounted) return;
showConfirmationDialog(context);
}).catchError((e, StackTrace s) {
log('$e', error: e, stackTrace: s);
if (!context.mounted) return;
showSnack(
text: _ResetPasswordPage.error,
duration: const Duration(seconds: 5),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/blackboard/blackboard_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void openDetails(
builder: (BuildContext context) => BlackboardDetails(view: view),
))
.then((BlackboardPopOption? popOption) {
if (popOption != null) {
if (popOption != null && context.mounted) {
if (popOption == BlackboardPopOption.deleted) {
logBlackboardDeleteEvent(context);
showUserConfirmationOfBlackboardDeleted(context);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/blackboard/blackboard_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ class __BlackboardDialogState extends State<_BlackboardDialog> {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) return;

final hasInputChanged = widget.bloc.hasInputChanged();
Expand Down
4 changes: 2 additions & 2 deletions app/lib/blackboard/blackboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class BlackboardPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/calendrical_events/page/calendrical_events_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class _CalendricalEventsPageState extends State<CalendricalEventsPage> {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/feedback/feedback_box_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class FeedbackPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/filesharing/file_sharing_page_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class FileSharingPageController extends StatelessWidget {
@override
Widget build(BuildContext context) {
final pageStateBloc = BlocProvider.of<FileSharingPageStateBloc>(context);
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) return;

final pageState = pageStateBloc.currentStateValue;
Expand Down
1 change: 1 addition & 0 deletions app/lib/filesharing/widgets/upload_file_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Future<void> showUploadFileDialog({
await uploadTask.onComplete.then((result) {
if (result.bytesTransferred == result.totalByteCount) {
analytics.log(NamedAnalyticsEvent(name: "file_add"));
if (!context.mounted) return;
Navigator.pop(context);
}
});
Expand Down
7 changes: 5 additions & 2 deletions app/lib/groups/group_join/group_join_result_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ class GroupJoinResultDialog {
Future<void> show(BuildContext context) {
hideKeyboard(context: context);
final joinResultStream = groupJoinBloc.joinResult;
final stateSheetContentStream = joinResultStream.map((joinResult) =>
mapStateSheetContentFromJoinResult(joinResult, context));
final stateSheetContentStream = joinResultStream.map((joinResult) {
if (!context.mounted) return const StateSheetContent(body: SizedBox());
return mapStateSheetContentFromJoinResult(joinResult, context);
});
joinResultStream.listen((joinResult) {
if (joinResult is RequireCourseSelectionsJoinResult) {
if (!context.mounted) return;
openGroupJoinCoursePageIfNotYetOpen(context, joinResult);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ class _CourseCreatePageState extends State<_CourseCreatePage> {
Widget build(BuildContext context) {
return BlocProvider(
bloc: bloc,
child: PopScope(
child: PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) return;

final hasInputChanged = bloc.hasUserEditInput();
Expand Down
4 changes: 2 additions & 2 deletions app/lib/groups/src/pages/course/group_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ class GroupPageState extends State<GroupPage> {
Widget build(BuildContext context) {
final gateway =
BlocProvider.of<SharezoneContext>(context).api.connectionsGateway;
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
4 changes: 2 additions & 2 deletions app/lib/homework/homework_dialog/homework_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ class HomeworkDialogMainState extends State<HomeworkDialogMain> {
const Center(child: CircularProgressIndicator()),
SavedSuccessfully() => throw UnimplementedError(
'Placeholder, we pop the Navigator above so this should not be reached.'),
Ready() => PopScope(
Ready() => PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) return;

final hasInputChanged = hasModifiedData();
Expand Down
2 changes: 2 additions & 0 deletions app/lib/homework/shared/homework_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class HomeworkCard extends StatelessWidget {
defaultValue: false,
name: HomeworkDetails.tag,
).then((value) {
if (!context.mounted) return;
if (value) showDataArrivalConfirmedSnackbar(context: context);
});
},
Expand Down Expand Up @@ -341,6 +342,7 @@ class HomeworkCardRedesigned extends StatelessWidget {
defaultValue: false,
name: HomeworkDetails.tag,
).then((value) {
if (!context.mounted) return;
if (value) showDataArrivalConfirmedSnackbar(context: context);
});
},
Expand Down
74 changes: 39 additions & 35 deletions app/lib/homework/student/src/mark_overdue_homework_prompt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,42 +49,46 @@ class _MarkOverdueHomeworkPromptState extends State<MarkOverdueHomeworkPrompt> {
analytics.log(_OverdueAnalyticsEvent.displayed());
return Padding(
padding: const EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0),
child: CustomCard(
borderWidth: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 10),
child: Text(
"Alle überfälligen Hausaufgaben abhaken?",
style: textTheme.titleLarge?.apply(fontSizeFactor: 0.9),
textAlign: TextAlign.center,
),
),
ButtonBar(
children: <Widget>[
TextButton(
child: const Text("Schließen"),
onPressed: () {
analytics.log(_OverdueAnalyticsEvent.closed());
setState(() {
visible = false;
});
cache.setAlreadyDismissed(true);
},
child: SizedBox(
width: MediaQuery.of(context).size.width,
child: CustomCard(
borderWidth: 2,
padding: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 10),
child: Text(
"Alle überfälligen Hausaufgaben abhaken?",
style: textTheme.titleLarge?.apply(fontSizeFactor: 0.9),
textAlign: TextAlign.center,
),
FilledButton(
onPressed: () {
analytics.log(_OverdueAnalyticsEvent.confirmed());
bloc.add(CompletedAllOverdue());
},
child: const Text("Abhaken"),
)
],
),
],
),
OverflowBar(
children: <Widget>[
TextButton(
child: const Text("Schließen"),
onPressed: () {
analytics.log(_OverdueAnalyticsEvent.closed());
setState(() {
visible = false;
});
cache.setAlreadyDismissed(true);
},
),
FilledButton(
onPressed: () {
analytics.log(_OverdueAnalyticsEvent.confirmed());
bloc.add(CompletedAllOverdue());
},
child: const Text("Abhaken"),
)
],
),
],
),
),
),
);
Expand Down
4 changes: 2 additions & 2 deletions app/lib/homework/student/student_homework_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class StudentHomeworkPage extends StatelessWidget {
Theme.of(context).isDarkTheme ? Colors.grey[900] : Colors.grey[100];
return ChangeNotifierProvider<BottomOfScrollViewInvisibilityController>(
create: (_) => BottomOfScrollViewInvisibilityController(),
child: PopScope(
child: PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class TeacherAndParentHomeworkPage extends StatelessWidget {
Theme.of(context).isDarkTheme ? Colors.grey[900] : Colors.grey[100];
return ChangeNotifierProvider<BottomOfScrollViewInvisibilityController>(
create: (_) => BottomOfScrollViewInvisibilityController(),
child: PopScope(
child: PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class __TextFieldSubmitButtonState extends State<_TextFieldSubmitButton> {
final schoolClassBloc = BlocProvider.of<MySchoolClassBloc>(context);
setState(() => isLoading = true);
schoolClassBloc.createSchoolClass(name).then((result) async {
if (!context.mounted) return;
if (result.hasData && result.data == true) {
isLoading = false;
final schoolClassID = schoolClassBloc.schoolClassId;
Expand Down
4 changes: 2 additions & 2 deletions app/lib/report/page/report_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class _ReportPageState extends State<ReportPage> {
Widget build(BuildContext context) {
return BlocProvider(
bloc: bloc,
child: PopScope(
child: PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) return;

final hasInputChanged = bloc.wasEdited();
Expand Down
4 changes: 2 additions & 2 deletions app/lib/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class SettingsPageBody extends StatelessWidget {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (didPop) return;
popToOverview(context);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ class __PeriodsEditPageState extends State<_PeriodsEditPage> {

@override
Widget build(BuildContext context) {
return PopScope(
return PopScope<Object?>(
canPop: false,
onPopInvoked: (didPop) async {
onPopInvokedWithResult: (didPop, _) async {
if (didPop) return;

final shouldPop = await warnUserAboutLeavingOrSavingForm(
Expand Down
Loading

0 comments on commit 28b529c

Please sign in to comment.