marco.pms.mobileapp/lib/view/dashboard/dashboard_screen.dart
Vaibhav Surve db0b525e87 Add Daily Task feature with controller, model, and UI integration
- Implement DailyTaskController for managing daily tasks and fetching projects.
- Create TaskModel to represent task data structure.
- Develop DailyTaskScreen for displaying tasks with filtering options.
- Update routes to include Daily Task navigation.
- Enhance DashboardScreen to link to Daily Task.
- Add Daily Task option in the left navigation bar.
2025-05-12 11:13:22 +05:30

119 lines
3.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_lucide/flutter_lucide.dart';
import 'package:get/get.dart';
import 'package:marco/helpers/theme/app_theme.dart';
import 'package:marco/helpers/utils/mixins/ui_mixin.dart';
import 'package:marco/helpers/utils/my_shadow.dart';
import 'package:marco/helpers/widgets/my_breadcrumb.dart';
import 'package:marco/helpers/widgets/my_breadcrumb_item.dart';
import 'package:marco/helpers/widgets/my_card.dart';
import 'package:marco/helpers/widgets/my_container.dart';
import 'package:marco/helpers/widgets/my_spacing.dart';
import 'package:marco/helpers/widgets/my_text.dart';
import 'package:marco/view/layouts/layout.dart';
class DashboardScreen extends StatelessWidget with UIMixin {
DashboardScreen({super.key});
static const String dashboardRoute = "/dashboard";
static const String employeesRoute = "/dashboard/employees";
static const String projectsRoute = "/dashboard";
static const String attendanceRoute = "/dashboard/attendance";
static const String tasksRoute = "/dashboard/daily-task";
@override
Widget build(BuildContext context) {
return Layout(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: MySpacing.x(flexSpacing),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MyText.titleMedium("Dashboard", fontSize: 18, fontWeight: 600),
MyBreadcrumb(children: [MyBreadcrumbItem(name: 'Dashboard')]),
],
),
),
MySpacing.height(flexSpacing),
Padding(
padding: MySpacing.x(flexSpacing / 2),
child: Column(
children: _buildDashboardStats(),
),
),
],
),
);
}
List<Widget> _buildDashboardStats() {
final stats = [
_StatItem(LucideIcons.gauge, "Dashboard", contentTheme.primary, dashboardRoute),
_StatItem(LucideIcons.scan_face, "Attendance", contentTheme.success, attendanceRoute),
_StatItem( LucideIcons.users, "Employees", contentTheme.warning, employeesRoute),
_StatItem(LucideIcons.logs, "Daily Task", contentTheme.info, tasksRoute),
_StatItem(LucideIcons.logs, "Daily Task Planing", contentTheme.info, tasksRoute),
_StatItem(LucideIcons.folder, "Projects", contentTheme.secondary, projectsRoute),
];
return List.generate(
(stats.length / 2).ceil(),
(index) => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildStatCard(stats[index * 2]),
if (index * 2 + 1 < stats.length)
_buildStatCard(stats[index * 2 + 1]),
],
),
);
}
Widget _buildStatCard(_StatItem statItem) {
return Expanded(
child: InkWell(
onTap: () => Get.toNamed(statItem.route),
child: MyCard.bordered(
borderRadiusAll: 10,
border: Border.all(color: Colors.grey.withOpacity(0.2)),
shadow: MyShadow(elevation: 1, position: MyShadowPosition.bottom),
paddingAll: 24,
height: 140,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildStatCardIcon(statItem),
MySpacing.height(12),
MyText.labelSmall(statItem.title, maxLines: 1),
],
),
),
),
);
}
Widget _buildStatCardIcon(_StatItem statItem) {
return MyContainer(
paddingAll: 16,
color: statItem.color.withOpacity(0.2),
child: MyContainer(
paddingAll: 8,
color: statItem.color,
child: Icon(statItem.icon, size: 16, color: contentTheme.light),
),
);
}
}
class _StatItem {
final IconData icon;
final String title;
final Color color;
final String route; // New field to store the route for each stat item
_StatItem(this.icon, this.title, this.color, this.route);
}