Skip to content

Commit

Permalink
Fix workouts not refreshing on delete
Browse files Browse the repository at this point in the history
  • Loading branch information
a-mabe committed Sep 27, 2024
1 parent 7760232 commit 519e1de
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/pages/view_workout/view_workout.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:io';
import 'package:openhiit/pages/home/home.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:uuid/uuid.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -127,8 +128,14 @@ class ViewWorkoutState extends State<ViewWorkout> {
? 40
: 80,
onDelete: () {
deleteList(workout).then((value) => Navigator.pop(context));
Navigator.of(context).pop();
deleteList(workout).then((value) {
if (context.mounted) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (_) => const MyHomePage()),
(route) => false);
}
});
},
onEdit: () {
Workout workoutCopy = workout.copy();
Expand Down

0 comments on commit 519e1de

Please sign in to comment.