mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
UndoSnackbar: Pass the StateContainer down
Not sure why fetching the StateContainer from the context seems to be failing and throwing an exception.
This commit is contained in:
@ -95,7 +95,7 @@ class NoteBrowsingScreenState extends State<NoteBrowsingScreen> {
|
||||
Navigator.pop(context);
|
||||
|
||||
Fimber.d("Shwoing an undo snackbar");
|
||||
showUndoDeleteSnackbar(context, note, noteIndex);
|
||||
showUndoDeleteSnackbar(context, stateContainer, note, noteIndex);
|
||||
}
|
||||
|
||||
Widget _buildAlertDialog(BuildContext context) {
|
||||
|
@ -44,6 +44,7 @@ Future<String> dumpAppLogs() async {
|
||||
|
||||
void showUndoDeleteSnackbar(
|
||||
BuildContext context,
|
||||
StateContainerState stateContainer,
|
||||
Note deletedNote,
|
||||
int deletedNoteIndex,
|
||||
) {
|
||||
@ -59,7 +60,6 @@ void showUndoDeleteSnackbar(
|
||||
),
|
||||
onPressed: () {
|
||||
Fimber.d("Undoing delete");
|
||||
var stateContainer = StateContainer.of(context);
|
||||
stateContainer.undoRemoveNote(deletedNote, deletedNoteIndex);
|
||||
},
|
||||
),
|
||||
|
@ -58,7 +58,7 @@ class JournalList extends StatelessWidget {
|
||||
final stateContainer = StateContainer.of(context);
|
||||
stateContainer.removeNote(note);
|
||||
|
||||
showUndoDeleteSnackbar(context, note, i);
|
||||
showUndoDeleteSnackbar(context, stateContainer, note, i);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
Reference in New Issue
Block a user