Skip to content

Commit

Permalink
Merge pull request #193 from sparcs-kaist/184-time-table-delete
Browse files Browse the repository at this point in the history
Fix #184, fix modal with deleting timetable
  • Loading branch information
sboh1214 authored Sep 14, 2024
2 parents 575f342 + d0cb5ef commit b7b2b06
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions lib/pages/timetable_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,39 +251,46 @@ class _TimetablePageState extends State<TimetablePage> {
},
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<TimetableModel>().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<TimetableModel>().deleteTimetable(),
),
);
});
}
},
onExportTap: (type) {
Expand Down

0 comments on commit b7b2b06

Please sign in to comment.