Add the ability to deselect a task
parent
a8023c2598
commit
a933f117fb
|
@ -73,4 +73,11 @@ class TaskViewModel with ChangeNotifier {
|
||||||
throw ArgumentError(errorMessage);
|
throw ArgumentError(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Deselects the currently selected task.
|
||||||
|
void deselectTask() {
|
||||||
|
_selectedTask = null;
|
||||||
|
print("Deselected the current task.");
|
||||||
|
notifyListeners(); // Notify listeners to rebuild UI
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ class _TaskViewState extends State<TaskView> {
|
||||||
final chatViewModel =
|
final chatViewModel =
|
||||||
Provider.of<ChatViewModel>(context, listen: false);
|
Provider.of<ChatViewModel>(context, listen: false);
|
||||||
chatViewModel.clearCurrentTaskAndChats();
|
chatViewModel.clearCurrentTaskAndChats();
|
||||||
|
widget.viewModel.deselectTask();
|
||||||
print(
|
print(
|
||||||
'New Task button pressed, cleared current task ID and chats');
|
'New Task button pressed, cleared current task ID and chats');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue