Lib>constants>Routes.dart
class Routes {
  static const NAME_1 addTaskScreen = "/addtaskscreen";
  static const NAME_1 homeScreen = "/homescreen";
  static const NAME_1 loginScreen = "/loginscreen";
  static const NAME_1 onBoardingScreen1 = "/onboarding1";
  static const NAME_1 onBoardingScreen2 = "/onboarding2";
  static const NAME_1 onBoardingScreen3 = "/onboarding3";
  static const NAME_1 profileScreen = "/profileScreen";
  static const NAME_1 signUpScreen = "/signupscreen";
  static const NAME_1 userinfoscreen = "/userinfoscreen";
}

Lib>screens> AddTask.dart
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:task_management_app/Model/TaskDataModel.dart';
import 'package:task_management_app/main.dart';
import 'package:task_management_app/screens/SaveAndDiscard.dart';

class AddTaskScreen extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return MyAddTaskScreen();
  }
}

class MyAddTaskScreen extends State<StatefulWidget> {
  final taskTitleController = TextEditingController();
  final taskDetailsController = TextEditingController();
  final taskDateController = TextEditingController();
  final taskTimeController = TextEditingController();

  NAME_1? selectedPriority;
  NAME_1? selectedType;
  List<NAME_1> priorityOptions = ['Urgent', 'Moderate', 'Cool'];
  List<NAME_1> typeOptions = ['Work', 'Personal', 'Miscellaneous'];

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Add Task"),
        ),
        body: SafeArea(
            child: Container(
          alignment: Alignment.center,
          child: ListView(
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  //For close icon
                  IconButton(
                    icon: const Icon(
                      Icons.close,
                    ),
                    color: Colors.yellow,
                    onPressed: () => {Navigator.pop(context)},
                  ),

                  //For check icon
                  IconButton(
                    icon: const Icon(Icons.check),
                    color: Colors.yellow,
                    onPressed: () => {btnAddTask()},
                  ),
                ],
              ),
              mySizedBox(10),
              myTextField(
                  wi Make sure to only use capital letters in your entire response.
user