Skip to content

Commit

Permalink
Add task feature when the task is added
Browse files Browse the repository at this point in the history
  • Loading branch information
abhisheksharma010 committed Jan 29, 2024
1 parent 2a2e1ba commit 32b39f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/services/task_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class DetailRoute extends StatefulWidget {

class _DetailRouteState extends State<DetailRoute> {
late Modify modify;

bool onedit = false;
@override
void didChangeDependencies() {
super.didChangeDependencies();
Expand All @@ -39,6 +39,7 @@ class _DetailRouteState extends State<DetailRoute> {
void Function(dynamic) callback(String name) {
return (newValue) {
modify.set(name, newValue);
onedit = true;
setState(() {});
};
}
Expand All @@ -48,6 +49,7 @@ class _DetailRouteState extends State<DetailRoute> {
modify.save(
modified: () => now,
);
onedit = true;
setState(() {});
Navigator.of(context).pop();
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
Expand All @@ -63,7 +65,9 @@ class _DetailRouteState extends State<DetailRoute> {
return PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
if (didPop) {
if (didPop || !onedit) {
// print(onedit);

await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const HomePage()),
(Route<dynamic> route) => false);
Expand Down

0 comments on commit 32b39f8

Please sign in to comment.