Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
FauconSpartiate committed Sep 7, 2024
1 parent a98dc01 commit 9e3038e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/ui/routes/home_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _HomePageState extends State<HomePage> {

WidgetsBinding.instance.addPostFrameCallback((_) async {
await Future.delayed(const Duration(milliseconds: 500), () {
if (!shouldShowcase || !mounted || context.findAncestorWidgetOfExactType<ShowCaseWidget>() == null) return;
if (!shouldShowcase || !context.mounted || context.findAncestorWidgetOfExactType<ShowCaseWidget>() == null) return;
ShowCaseWidget.of(context).startShowCase([showCaseKey]);
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/routes/main_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class RouteWidgetState extends State<RouteWidget> with TickerProviderStateMixin
resizeToAvoidBottomInset: false,
body: PlatformWillPopScope(
canPop: canPop,
onPopInvoked: (didPop) {
onPopInvoked: (didPop, _) {
if (didPop) return;
if (children.every((e) => e is HomePage) && tabController.length > 1 && tabController.index == tabController.length - 1) {
int newIndex = tabController.previousIndex;
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/routes/setup_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class _SetupPageState extends State<SetupPage> {
@override
Widget build(BuildContext context) {
return PopScope(
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (!didPop) return;
SetupManager.dispose();
},
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/routes/subject_edit_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class _SubjectEditRouteState extends SpinningFabPage<SubjectEditRoute> {
final String title = widget.creationType == CreationType.edit ? translations.edit_subjectOther : translations.add_subjectOther;

return PopScope(
onPopInvoked: (didPop) {
onPopInvokedWithResult: (didPop, _) {
if (!didPop) return;
ScaffoldMessenger.of(context).removeCurrentSnackBar();
},
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/routes/subject_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,13 @@ class _SubjectRouteState extends SpinningFabPage<SubjectRoute> {
leadingText: testData[index].name,
trailingText: testData[index].toString(),
enableEqualLongPress: true,
onTap: () async {
onTap: () {
if (widget.term.isYearOverview) return;

showMenuActions<MenuAction>(context, MenuAction.values, [translations.edit, translations.delete]).then((result) {
switch (result) {
case MenuAction.edit:
if (!context.mounted) return;
showTestDialog(context, widget.subject, test: testData[index]).then((_) => refreshYearOverview());
case MenuAction.delete:
heavyHaptics();
Expand Down
1 change: 1 addition & 0 deletions lib/ui/routes/year_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class _YearRouteState extends SpinningFabPage<YearRoute> {

void showPopupActions(BuildContext context, int index, Year year) {
showMenuActions<YearAction>(context, YearAction.values, [translations.select, translations.edit, translations.delete]).then((result) {
if (!context.mounted) return;
switch (result) {
case YearAction.select:
heavyHaptics();
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/widgets/list_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class _SubjectTileState extends State<SubjectTile> {

WidgetsBinding.instance.addPostFrameCallback((_) async {
await Future.delayed(const Duration(milliseconds: 500), () {
if (!widget.shouldShowcase || !mounted || context.findAncestorWidgetOfExactType<ShowCaseWidget>() == null) return;
if (!widget.shouldShowcase || !context.mounted || context.findAncestorWidgetOfExactType<ShowCaseWidget>() == null) return;
ShowCaseWidget.of(context).startShowCase([showCaseKey1, showCaseKey2]);
});
});
Expand Down Expand Up @@ -298,6 +298,7 @@ class _SubjectTileState extends State<SubjectTile> {
showMenuActions<MenuAction>(context, MenuAction.values, [translations.edit, translations.delete]).then((result) {
switch (result) {
case MenuAction.edit:
if (!context.mounted) return;
showSubjectDialog(
context,
index1: widget.index1,
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/widgets/misc_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ class PlatformWillPopScope extends StatelessWidget {
required this.child,
});

final void Function(bool)? onPopInvoked;
final void Function(bool, dynamic)? onPopInvoked;
final bool? canPop;
final Widget child;

@override
Widget build(BuildContext context) {
return !isiOS
? PopScope(
onPopInvoked: onPopInvoked,
onPopInvokedWithResult: onPopInvoked,
canPop: canPop ?? true,
child: child,
)
Expand Down
1 change: 1 addition & 0 deletions lib/ui/widgets/settings_tiles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class ImportSettingsTile extends StatelessWidget {
subtitle: translations.import_description,
onTap: () => importData().then((success) {
if (!success) heavyHaptics();
if (!context.mounted) return;

ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
Expand Down

0 comments on commit 9e3038e

Please sign in to comment.