From 03a3c1e06c7fa06e18eef5ec1906cb7fddd7640c Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Wed, 10 Dec 2025 11:36:11 +0530 Subject: [PATCH] corrected --- .../taskPlanning/daily_task_planning.dart | 98 +++++++++++-------- 1 file changed, 58 insertions(+), 40 deletions(-) diff --git a/lib/view/taskPlanning/daily_task_planning.dart b/lib/view/taskPlanning/daily_task_planning.dart index 8ab34e7..d30f251 100644 --- a/lib/view/taskPlanning/daily_task_planning.dart +++ b/lib/view/taskPlanning/daily_task_planning.dart @@ -446,47 +446,65 @@ class _DailyTaskPlanningScreenState extends State .hasPermission(Permissions .assignReportTask)) IconButton( - icon: const Icon( - Icons.person_add_alt_1_rounded, - color: Color.fromARGB( - 255, 46, 161, 233), - ), - onPressed: () { - final pendingTask = - (planned - completed) - .clamp(0, planned) - .toInt(); + icon: const Icon( + Icons + .person_add_alt_1_rounded, + color: Color.fromARGB( + 255, 46, 161, 233), + ), + onPressed: () async { + final pendingTask = + (planned - completed) + .clamp(0, planned) + .toInt(); - showModalBottomSheet( - context: context, - isScrollControlled: true, - shape: - const RoundedRectangleBorder( - borderRadius: - BorderRadius.vertical( - top: - Radius.circular( - 16)), - ), - builder: (context) => - AssignTaskBottomSheet( - buildingName: building.name, - floorName: floor.floorName, - workAreaName: area.areaName, - workLocation: area.areaName, - activityName: item - .activityMaster - ?.name ?? - "Unknown Activity", - pendingTask: pendingTask, - workItemId: - item.id.toString(), - assignmentDate: - DateTime.now(), - ), - ); - }, - ), + // Wait until user closes bottom sheet + await showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: + const RoundedRectangleBorder( + borderRadius: + BorderRadius.vertical( + top: Radius + .circular( + 16)), + ), + builder: (context) => + AssignTaskBottomSheet( + buildingName: + building.name, + floorName: + floor.floorName, + workAreaName: + area.areaName, + workLocation: + area.areaName, + activityName: item + .activityMaster + ?.name ?? + "Unknown Activity", + pendingTask: pendingTask, + workItemId: + item.id.toString(), + assignmentDate: + DateTime.now(), + ), + ); + + final projectId = + widget.projectId; + if (projectId.isNotEmpty) { + await dailyTaskPlanningController + .fetchTaskData( + projectId, + serviceId: + serviceController + .selectedService + ?.id, + ); + } + }), ], ), MySpacing.height(4),