handleSubmit method

void handleSubmit(
  1. BuildContext context
)

Implementation

void handleSubmit(BuildContext context) async {
  try {
    final newTask = await projectService.submitNewTask(
      titleController.text,
      descriptionController.text,
    );

    // Call the onTaskCreated callback to update the UI with the new task
    onTaskCreated(newTask);

    // Clear the input fields
    titleController.clear();
    descriptionController.clear();

    // Close the modal
    Navigator.pop(context);
  } catch (error) {
    // Handle any errors during the submission
    print('Failed to submit task: $error');
  }
}