Skip to content

Commit

Permalink
fixed Unnecessary Alert on Unchanged Task Page Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
yaviral17 committed Jan 28, 2024
1 parent 6dce549 commit 07b08d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/services/task_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DetailRoute extends StatefulWidget {

class _DetailRouteState extends State<DetailRoute> {
late Modify modify;
bool isModified = false;

@override
void didChangeDependencies() {
Expand All @@ -37,6 +38,7 @@ class _DetailRouteState extends State<DetailRoute> {
}

void Function(dynamic) callback(String name) {
isModified = true;
return (newValue) {
modify.set(name, newValue);
setState(() {});
Expand All @@ -61,7 +63,7 @@ class _DetailRouteState extends State<DetailRoute> {
@override
Widget build(BuildContext context) {
return PopScope(
canPop: false,
canPop: !isModified,
onPopInvoked: (bool didPop) async {
if (didPop) {
await Navigator.of(context).pushAndRemoveUntil(
Expand Down

0 comments on commit 07b08d5

Please sign in to comment.