Refactor dashboard screen layout and improve loading state handling

- Simplified initialization of DynamicMenuController.
- Added loading skeleton for employee quick action cards.
- Removed daily task planning and daily progress report from card order.
- Adjusted grid layout parameters for better responsiveness.
- Cleaned up code formatting for improved readability.
This commit is contained in:
Vaibhav Surve 2025-12-03 17:08:25 +05:30
parent 3dfa6e5877
commit 8fb32c7c8e
2 changed files with 1237 additions and 1028 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,7 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
Get.put(DashboardController(), permanent: true);
final AttendanceController attendanceController =
Get.put(AttendanceController());
final DynamicMenuController menuController =
Get.put(DynamicMenuController());
final DynamicMenuController menuController = Get.put(DynamicMenuController());
final ProjectController projectController = Get.find<ProjectController>();
bool hasMpin = true;
@ -97,6 +96,11 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
children: [
_sectionTitle('Quick Action'),
Obx(() {
if (dashboardController.isLoadingEmployees.value) {
// Show loading skeleton
return SkeletonLoaders.attendanceQuickCardSkeleton();
}
final employees = dashboardController.employees;
final employee = employees.isNotEmpty ? employees.first : null;
@ -121,6 +125,7 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
);
}
// Actual employee quick action card
final bool isCheckedIn = employee.checkIn != null;
final bool isCheckedOut = employee.checkOut != null;
@ -233,8 +238,6 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
final List<String> cardOrder = [
MenuItems.attendance,
MenuItems.employees,
MenuItems.dailyTaskPlanning,
MenuItems.dailyProgressReport,
MenuItems.directory,
MenuItems.finance,
MenuItems.documents,
@ -247,14 +250,10 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
_DashboardCardMeta(LucideIcons.scan_face, contentTheme.success),
MenuItems.employees:
_DashboardCardMeta(LucideIcons.users, contentTheme.warning),
MenuItems.dailyTaskPlanning:
_DashboardCardMeta(LucideIcons.logs, contentTheme.info),
MenuItems.dailyProgressReport:
_DashboardCardMeta(LucideIcons.list_todo, contentTheme.info),
MenuItems.directory:
_DashboardCardMeta(LucideIcons.folder, contentTheme.info),
MenuItems.finance:
_DashboardCardMeta(LucideIcons.wallet, contentTheme.info),
_DashboardCardMeta(LucideIcons.wallet, contentTheme.info),
MenuItems.documents:
_DashboardCardMeta(LucideIcons.file_text, contentTheme.info),
MenuItems.serviceProjects:
@ -314,10 +313,10 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 2),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisSpacing: 8,
crossAxisCount: 3,
crossAxisSpacing: 15,
mainAxisSpacing: 8,
childAspectRatio: 1.15,
childAspectRatio: 1.8,
),
itemCount: filtered.length,
itemBuilder: (context, index) {
@ -367,9 +366,8 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
Icon(
cardMeta.icon,
size: 20,
color: isEnabled
? cardMeta.color
: Colors.grey.shade300,
color:
isEnabled ? cardMeta.color : Colors.grey.shade300,
),
const SizedBox(height: 6),
Padding(
@ -379,9 +377,8 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 10,
fontWeight: isEnabled
? FontWeight.w600
: FontWeight.w400,
fontWeight:
isEnabled ? FontWeight.w600 : FontWeight.w400,
color: isEnabled
? Colors.black87
: Colors.grey.shade400,
@ -424,11 +421,9 @@ class _DashboardScreenState extends State<DashboardScreen> with UIMixin {
children: [
_sectionTitle('Project'),
GestureDetector(
onTap: () =>
projectController.isProjectSelectionExpanded.toggle(),
onTap: () => projectController.isProjectSelectionExpanded.toggle(),
child: Container(
padding:
const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5),