diff --git a/lib/widgets/add_Task.dart b/lib/widgets/add_Task.dart index 3565e09f..159ee993 100644 --- a/lib/widgets/add_Task.dart +++ b/lib/widgets/add_Task.dart @@ -130,9 +130,6 @@ class _AddTaskBottomSheetState extends State { color: AppSettings.isDarkMode ? Colors.white : Colors.black, ), ), - validator: (name) => name != null && name.isEmpty - ? 'due date is required' - : null, onTap: () async { var date = await showDatePicker( builder: (BuildContext context, Widget? child) { @@ -319,20 +316,6 @@ class _AddTaskBottomSheetState extends State { ), onPressed: () async { if (formKey.currentState!.validate()) { - if (due == null) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - 'Due date cannot be empty. Please select a due date.', - style: TextStyle( - color: AppSettings.isDarkMode ? Colors.white : Colors.black, - ), - ), - backgroundColor: - AppSettings.isDarkMode ? Colors.black : Colors.white, - duration: const Duration(seconds: 2), - )); - return; - } try { var task = taskParser(namecontroller.text) .rebuild((b) => b..due = due) diff --git a/lib/widgets/buildTasks.dart b/lib/widgets/buildTasks.dart index 01e8df2e..2e8f695f 100644 --- a/lib/widgets/buildTasks.dart +++ b/lib/widgets/buildTasks.dart @@ -154,24 +154,23 @@ class _TasksBuilderState extends State { onPressed: () { setStatus( 'completed', task.uuid); - DateTime? dtb = task.due; - dtb = dtb!.add( - const Duration(minutes: 1)); - final FlutterLocalNotificationsPlugin - flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); - flutterLocalNotificationsPlugin - .cancel(dtb.day * 100 + + if (task.due != null) { + DateTime? dtb = task.due; + dtb = dtb!.add(const Duration( + minutes: 1)); + final FlutterLocalNotificationsPlugin + flutterLocalNotificationsPlugin = + FlutterLocalNotificationsPlugin(); + flutterLocalNotificationsPlugin + .cancel(dtb.day * 100 + + dtb.hour * 10 + + dtb.minute); + if (kDebugMode) { + print("Task due is $dtb"); + print(dtb.day * 100 + dtb.hour * 10 + dtb.minute); - - if (kDebugMode) { - print("Task due is $dtb"); - print(widget - .taskData); // status is in first index - print(dtb.day * 100 + - dtb.hour * 10 + - dtb.minute); + } } Navigator.of(context).pop(); @@ -210,22 +209,25 @@ class _TasksBuilderState extends State { TextButton( onPressed: () { setStatus('deleted', task.uuid); - DateTime? dtb = task.due; - dtb = dtb!.add( - const Duration(minutes: 1)); - final FlutterLocalNotificationsPlugin - flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); - flutterLocalNotificationsPlugin - .cancel(dtb.day * 100 + + if (task.due != null) { + DateTime? dtb = task.due; + dtb = dtb!.add(const Duration( + minutes: 1)); + final FlutterLocalNotificationsPlugin + flutterLocalNotificationsPlugin = + FlutterLocalNotificationsPlugin(); + flutterLocalNotificationsPlugin + .cancel(dtb.day * 100 + + dtb.hour * 10 + + dtb.minute); + if (kDebugMode) { + print("Task due is $dtb"); + print(dtb.day * 100 + dtb.hour * 10 + dtb.minute); - if (kDebugMode) { - print("Task due is$dtb"); - print(dtb.day * 100 + - dtb.hour * 10 + - dtb.minute); + } } + Navigator.of(context).pop(); }, child: const Text('Yes'), diff --git a/pubspec.lock b/pubspec.lock index 177d1245..31287d8c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -600,30 +600,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.1" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: e45c31f458d01fd9ef4a214feb2e153b72d5b1907435f4332b1637a2f348c021 - url: "https://pub.dev" - source: hosted - version: "9.0.18" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: "54808cfcfa87dbc0d74c61ac063d624adf1bd5c0407301f32b06c783c60dc4ca" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: "7e71be3c161472f6c9158ac8875dd8de575060d60b5d159ebca3600ea32c9116" - url: "https://pub.dev" - source: hosted - version: "1.0.6" lints: dependency: transitive description: @@ -652,26 +628,26 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.10.0" mime: dependency: transitive description: @@ -716,10 +692,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" path_parsing: dependency: transitive description: @@ -1229,14 +1205,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 - url: "https://pub.dev" - source: hosted - version: "13.0.0" watcher: dependency: transitive description: