diff --git a/lib/pages/timetable_page.dart b/lib/pages/timetable_page.dart index 4c24e1a8..89f9fbaf 100644 --- a/lib/pages/timetable_page.dart +++ b/lib/pages/timetable_page.dart @@ -251,39 +251,46 @@ class _TimetablePageState extends State { }, onDeleteTap: (i) { if (i == 0) { - OTLNavigator.pushDialog( - context: context, - builder: (_) => OTLDialog( - type: OTLDialogType.accountDeleted, + WidgetsBinding.instance.addPostFrameCallback((_) { + OTLNavigator.pushDialog( + context: context, + builder: (_) => OTLDialog( + type: OTLDialogType.accountDeleted, + namedArgs: { + 'timetable': 'timetable.tab' + .tr(args: [timetableModel.selectedIndex.toString()]) + }, + onTapPos: () {}), + ); + }); + } else if (timetableModel.timetables.length <= 2) { + WidgetsBinding.instance.addPostFrameCallback((_) { + OTLNavigator.pushDialog( + context: context, + builder: (_) => OTLDialog( + type: OTLDialogType.disabledDeleteLastTab, namedArgs: { 'timetable': 'timetable.tab' .tr(args: [timetableModel.selectedIndex.toString()]) }, - onTapPos: () {}), - ); - } else if (timetableModel.timetables.length <= 2) { - OTLNavigator.pushDialog( - context: context, - builder: (_) => OTLDialog( - type: OTLDialogType.disabledDeleteLastTab, - namedArgs: { - 'timetable': 'timetable.tab' - .tr(args: [timetableModel.selectedIndex.toString()]) - }, - ), - ); + ), + ); + }); } else { - OTLNavigator.pushDialog( - context: context, - builder: (_) => OTLDialog( - type: OTLDialogType.deleteTab, - namedArgs: { - 'timetable': 'timetable.tab' - .tr(args: [timetableModel.selectedIndex.toString()]) - }, - onTapPos: () => context.read().deleteTimetable(), - ), - ); + WidgetsBinding.instance.addPostFrameCallback((_) { + OTLNavigator.pushDialog( + context: context, + builder: (_) => OTLDialog( + type: OTLDialogType.deleteTab, + namedArgs: { + 'timetable': 'timetable.tab' + .tr(args: [timetableModel.selectedIndex.toString()]) + }, + onTapPos: () => + context.read().deleteTimetable(), + ), + ); + }); } }, onExportTap: (type) {