Refactor EmployeeScreen to use Obx for loading state and remove commented-out action buttons
This commit is contained in:
parent
7281794fcf
commit
fb2823c340
@ -41,9 +41,11 @@ class _EmployeeScreenState extends State<EmployeeScreen> with UIMixin {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Layout(
|
return Layout(
|
||||||
child: Stack(
|
child: Obx(() {
|
||||||
children: [
|
return LoadingComponent(
|
||||||
GetBuilder<EmployeesScreenController>(
|
isLoading: employeesScreenController.isLoading.value,
|
||||||
|
loadingText: 'Loading Employees...',
|
||||||
|
child: GetBuilder<EmployeesScreenController>(
|
||||||
init: employeesScreenController,
|
init: employeesScreenController,
|
||||||
builder: (controller) {
|
builder: (controller) {
|
||||||
return Column(
|
return Column(
|
||||||
@ -155,22 +157,8 @@ class _EmployeeScreenState extends State<EmployeeScreen> 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<EmployeeScreen> with UIMixin {
|
|||||||
DataColumn(label: MyText.labelLarge('Name', color: contentTheme.primary)),
|
DataColumn(label: MyText.labelLarge('Name', color: contentTheme.primary)),
|
||||||
DataColumn(
|
DataColumn(
|
||||||
label: MyText.labelLarge('Contact', color: contentTheme.primary)),
|
label: MyText.labelLarge('Contact', color: contentTheme.primary)),
|
||||||
// DataColumn(
|
|
||||||
// label: MyText.labelLarge('Actions', color: contentTheme.primary)),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
final rows =
|
final rows =
|
||||||
@ -217,26 +203,6 @@ class _EmployeeScreenState extends State<EmployeeScreen> 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();
|
}).toList();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user