From fb2823c340d4fd59d8c00881ce9416b44e448b5f Mon Sep 17 00:00:00 2001 From: Vaibhav Surve Date: Fri, 9 May 2025 10:41:30 +0530 Subject: [PATCH] Refactor EmployeeScreen to use Obx for loading state and remove commented-out action buttons --- lib/view/dashboard/employee_screen.dart | 48 ++++--------------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/lib/view/dashboard/employee_screen.dart b/lib/view/dashboard/employee_screen.dart index 27f3ce4..ef6b319 100644 --- a/lib/view/dashboard/employee_screen.dart +++ b/lib/view/dashboard/employee_screen.dart @@ -41,9 +41,11 @@ class _EmployeeScreenState extends State with UIMixin { @override Widget build(BuildContext context) { return Layout( - child: Stack( - children: [ - GetBuilder( + child: Obx(() { + return LoadingComponent( + isLoading: employeesScreenController.isLoading.value, + loadingText: 'Loading Employees...', + child: GetBuilder( init: employeesScreenController, builder: (controller) { return Column( @@ -155,22 +157,8 @@ class _EmployeeScreenState extends State with UIMixin { ); }, ), - Obx(() { - return employeesScreenController.isLoading.value - ? Container( - color: Colors.black.withOpacity(0.05), - child: const Center( - child: LoadingComponent( - isLoading: true, - loadingText: 'Loading Employees...', - child: SizedBox.shrink(), - ), - ), - ) - : const SizedBox.shrink(); - }), - ], - ), + ); + }), ); } @@ -186,8 +174,6 @@ class _EmployeeScreenState extends State with UIMixin { DataColumn(label: MyText.labelLarge('Name', color: contentTheme.primary)), DataColumn( label: MyText.labelLarge('Contact', color: contentTheme.primary)), - // DataColumn( - // label: MyText.labelLarge('Actions', color: contentTheme.primary)), ]; final rows = @@ -217,26 +203,6 @@ class _EmployeeScreenState extends State with UIMixin { ], ), ), - // DataCell( - // Row( - // children: [ - // IconButton( - // icon: const Icon(Icons.visibility), - // tooltip: 'View', - // onPressed: () { - // // View employee action - // }, - // ), - // IconButton( - // icon: const Icon(Icons.edit), - // tooltip: 'Edit', - // onPressed: () { - // // Edit employee action - // }, - // ), - // ], - // ), - // ), ], ); }).toList();