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:
Vishesh Handa
2019-10-09 00:22:17 +02:00
parent 7f557d3d3e
commit df96467353
3 changed files with 3 additions and 3 deletions

View File

@ -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) {

View File

@ -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);
},
),

View File

@ -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);
},
);
},