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