feat: Refactor project selection handling and update UI across various screens

This commit is contained in:
Vaibhav Surve 2025-06-12 11:31:36 +05:30
parent b81ac33b2d
commit 56efbe8869
6 changed files with 492 additions and 385 deletions

View File

@ -16,6 +16,11 @@ class ProjectController extends GetxController {
RxBool isLoading = true.obs; RxBool isLoading = true.obs;
RxBool isLoadingProjects = true.obs; RxBool isLoadingProjects = true.obs;
RxMap<String, RxBool> uploadingStates = <String, RxBool>{}.obs; RxMap<String, RxBool> uploadingStates = <String, RxBool>{}.obs;
ProjectModel? get selectedProject {
if (selectedProjectId == null || selectedProjectId!.value.isEmpty)
return null;
return projects.firstWhereOrNull((p) => p.id == selectedProjectId!.value);
}
@override @override
void onInit() { void onInit() {

View File

@ -3,15 +3,12 @@ import 'package:get/get.dart';
import 'package:marco/helpers/theme/app_theme.dart'; import 'package:marco/helpers/theme/app_theme.dart';
import 'package:marco/helpers/utils/mixins/ui_mixin.dart'; import 'package:marco/helpers/utils/mixins/ui_mixin.dart';
import 'package:marco/helpers/utils/my_shadow.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_card.dart';
import 'package:marco/helpers/widgets/my_container.dart'; import 'package:marco/helpers/widgets/my_container.dart';
import 'package:marco/helpers/widgets/my_flex.dart'; import 'package:marco/helpers/widgets/my_flex.dart';
import 'package:marco/helpers/widgets/my_flex_item.dart'; import 'package:marco/helpers/widgets/my_flex_item.dart';
import 'package:marco/helpers/widgets/my_spacing.dart'; import 'package:marco/helpers/widgets/my_spacing.dart';
import 'package:marco/helpers/widgets/my_text.dart'; import 'package:marco/helpers/widgets/my_text.dart';
import 'package:marco/view/layouts/layout.dart';
import 'package:marco/controller/dashboard/attendance_screen_controller.dart'; import 'package:marco/controller/dashboard/attendance_screen_controller.dart';
import 'package:marco/controller/permission_controller.dart'; import 'package:marco/controller/permission_controller.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -20,7 +17,7 @@ import 'package:marco/model/attendance/log_details_view.dart';
import 'package:marco/model/attendance/attendence_action_button.dart'; import 'package:marco/model/attendance/attendence_action_button.dart';
import 'package:marco/model/attendance/regualrize_action_button.dart'; import 'package:marco/model/attendance/regualrize_action_button.dart';
import 'package:marco/model/attendance/attendence_filter_sheet.dart'; import 'package:marco/model/attendance/attendence_filter_sheet.dart';
import 'package:marco/controller/project_controller.dart'; // adjust if needed import 'package:marco/controller/project_controller.dart';
class AttendanceScreen extends StatefulWidget { class AttendanceScreen extends StatefulWidget {
AttendanceScreen({super.key}); AttendanceScreen({super.key});
@ -57,7 +54,55 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Layout( return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(80),
child: AppBar(
backgroundColor: const Color(0xFFF5F5F5),
elevation: 0.5,
foregroundColor: Colors.black,
titleSpacing: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new,
color: Colors.black, size: 20),
onPressed: () {
Get.offNamed('/dashboard');
},
),
title: Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
MyText.titleLarge(
'Attendance',
fontWeight: 700,
color: Colors.black,
),
const SizedBox(height: 4),
GetBuilder<ProjectController>(
builder: (projectController) {
final projectName =
projectController.selectedProject?.name ??
'Select Project';
return MyText.bodySmall(
projectName,
fontWeight: 600,
maxLines: 1,
overflow: TextOverflow.ellipsis,
color: Colors.grey[700],
);
},
),
],
),
),
),
),
body: SafeArea(
child: SingleChildScrollView(
padding: MySpacing.x(0),
child: GetBuilder<AttendanceController>( child: GetBuilder<AttendanceController>(
init: attendanceController, init: attendanceController,
tag: 'attendance_dashboard_controller', tag: 'attendance_dashboard_controller',
@ -65,43 +110,24 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding(
padding: MySpacing.x(flexSpacing),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MyText.titleMedium("Attendance",
fontSize: 18, fontWeight: 600),
MyBreadcrumb(
children: [
MyBreadcrumbItem(name: 'Dashboard'),
MyBreadcrumbItem(name: 'Attendance', active: true),
],
),
],
),
),
MySpacing.height(flexSpacing), MySpacing.height(flexSpacing),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
MyText.bodyMedium( MyText.bodyMedium("Filter", fontWeight: 600),
"Filter",
fontWeight: 600,
),
Tooltip( Tooltip(
message: 'Filter Project', message: 'Filter Project',
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
onTap: () async { onTap: () async {
final result = final result = await showModalBottomSheet<
await showModalBottomSheet<Map<String, dynamic>>( Map<String, dynamic>>(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: borderRadius: BorderRadius.vertical(
BorderRadius.vertical(top: Radius.circular(12)), top: Radius.circular(12)),
), ),
builder: (context) => AttendanceFilterBottomSheet( builder: (context) => AttendanceFilterBottomSheet(
controller: attendanceController, controller: attendanceController,
@ -116,7 +142,8 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
.selectedProjectId .selectedProjectId
?.value; ?.value;
final selectedView = result['selectedTab'] as String?; final selectedView =
result['selectedTab'] as String?;
if (selectedProjectId != null && if (selectedProjectId != null &&
selectedProjectId != selectedProjectId !=
@ -125,16 +152,18 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
selectedProjectId; selectedProjectId;
try { try {
await attendanceController await attendanceController
.fetchEmployeesByProject(selectedProjectId); .fetchEmployeesByProject(
selectedProjectId);
await attendanceController await attendanceController
.fetchAttendanceLogs(selectedProjectId); .fetchAttendanceLogs(selectedProjectId);
await attendanceController await attendanceController
.fetchRegularizationLogs(selectedProjectId); .fetchRegularizationLogs(
selectedProjectId);
await attendanceController await attendanceController
.fetchProjectData(selectedProjectId); .fetchProjectData(selectedProjectId);
} catch (_) {} } catch (_) {}
attendanceController attendanceController.update(
.update(['attendance_dashboard_controller']); ['attendance_dashboard_controller']);
} }
if (selectedView != null && if (selectedView != null &&
@ -159,10 +188,7 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
), ),
), ),
const SizedBox(width: 4), const SizedBox(width: 4),
MyText.bodyMedium( MyText.bodyMedium("Refresh", fontWeight: 600),
"Refresh",
fontWeight: 600,
),
Tooltip( Tooltip(
message: 'Refresh Data', message: 'Refresh Data',
child: InkWell( child: InkWell(
@ -182,8 +208,8 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
.fetchRegularizationLogs(projectId); .fetchRegularizationLogs(projectId);
await attendanceController await attendanceController
.fetchProjectData(projectId); .fetchProjectData(projectId);
attendanceController attendanceController.update(
.update(['attendance_dashboard_controller']); ['attendance_dashboard_controller']);
} catch (e) { } catch (e) {
debugPrint("Error refreshing data: $e"); debugPrint("Error refreshing data: $e");
} }
@ -204,9 +230,8 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
), ),
], ],
), ),
Padding( MySpacing.height(flexSpacing),
padding: MySpacing.x(0), MyFlex(children: [
child: MyFlex(children: [
MyFlexItem( MyFlexItem(
sizes: 'lg-12 md-12 sm-12', sizes: 'lg-12 md-12 sm-12',
child: selectedTab == 'todaysAttendance' child: selectedTab == 'todaysAttendance'
@ -216,11 +241,12 @@ class _AttendanceScreenState extends State<AttendanceScreen> with UIMixin {
: regularizationScreen(), : regularizationScreen(),
), ),
]), ]),
),
], ],
); );
}, },
), ),
),
),
); );
} }

View File

@ -8,14 +8,13 @@ import 'package:marco/helpers/widgets/my_breadcrumb_item.dart';
import 'package:marco/helpers/widgets/my_card.dart'; import 'package:marco/helpers/widgets/my_card.dart';
import 'package:marco/helpers/widgets/my_spacing.dart'; import 'package:marco/helpers/widgets/my_spacing.dart';
import 'package:marco/helpers/widgets/my_text.dart'; import 'package:marco/helpers/widgets/my_text.dart';
import 'package:marco/view/layouts/layout.dart';
import 'package:marco/controller/permission_controller.dart'; import 'package:marco/controller/permission_controller.dart';
import 'package:marco/model/employees/employees_screen_filter_sheet.dart'; import 'package:marco/model/employees/employees_screen_filter_sheet.dart';
import 'package:marco/model/employees/add_employee_bottom_sheet.dart'; import 'package:marco/model/employees/add_employee_bottom_sheet.dart';
import 'package:marco/controller/dashboard/employees_screen_controller.dart'; import 'package:marco/controller/dashboard/employees_screen_controller.dart';
import 'package:marco/helpers/widgets/avatar.dart'; import 'package:marco/helpers/widgets/avatar.dart';
import 'package:marco/model/employees/employee_detail_bottom_sheet.dart'; import 'package:marco/model/employees/employee_detail_bottom_sheet.dart';
import 'package:marco/controller/project_controller.dart';
class EmployeesScreen extends StatefulWidget { class EmployeesScreen extends StatefulWidget {
const EmployeesScreen({super.key}); const EmployeesScreen({super.key});
@ -79,7 +78,52 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Layout( return Scaffold(
backgroundColor: const Color(0xFFF5F5F5),
appBar: PreferredSize(
preferredSize: const Size.fromHeight(80),
child: AppBar(
backgroundColor: const Color(0xFFF5F5F5),
elevation: 0.5,
foregroundColor: Colors.black,
titleSpacing: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new),
onPressed: () {
Get.offNamed('/dashboard');
},
),
title: Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
MyText.titleLarge(
'Employees',
fontWeight: 700,
color: Colors.black,
),
const SizedBox(height: 4),
GetBuilder<ProjectController>(
builder: (projectController) {
final projectName =
projectController.selectedProject?.name ??
'Select Project';
return MyText.bodySmall(
projectName,
fontWeight: 600,
maxLines: 1,
overflow: TextOverflow.ellipsis,
color: Colors.grey[700],
);
},
),
],
),
),
),
),
floatingActionButton: InkWell( floatingActionButton: InkWell(
onTap: () async { onTap: () async {
final result = await showModalBottomSheet<bool>( final result = await showModalBottomSheet<bool>(
@ -120,13 +164,14 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
), ),
), ),
), ),
body: SafeArea(
child: GetBuilder<EmployeesScreenController>( child: GetBuilder<EmployeesScreenController>(
init: employeeScreenController, init: employeeScreenController,
tag: 'employee_screen_controller', tag: 'employee_screen_controller',
builder: (controller) { builder: (controller) {
return Stack( return SingleChildScrollView(
children: [ padding: const EdgeInsets.only(bottom: 80),
Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
@ -134,11 +179,6 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
MyText.titleMedium(
"Employees",
fontSize: 18,
fontWeight: 600,
),
MyBreadcrumb( MyBreadcrumb(
children: [ children: [
MyBreadcrumbItem(name: 'Dashboard'), MyBreadcrumbItem(name: 'Dashboard'),
@ -154,10 +194,7 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
MyText.bodyMedium( MyText.bodyMedium("Filter", fontWeight: 600),
"Filter",
fontWeight: 600,
),
Tooltip( Tooltip(
message: 'Project', message: 'Project',
child: InkWell( child: InkWell(
@ -177,10 +214,7 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
MyText.bodyMedium( MyText.bodyMedium("Refresh", fontWeight: 600),
"Refresh",
fontWeight: 600,
),
Tooltip( Tooltip(
message: 'Refresh Data', message: 'Refresh Data',
child: InkWell( child: InkWell(
@ -208,10 +242,10 @@ class _EmployeesScreenState extends State<EmployeesScreen> with UIMixin {
), ),
], ],
), ),
],
); );
}, },
), ),
),
); );
} }

View File

@ -9,6 +9,7 @@ import 'package:marco/helpers/services/api_endpoints.dart';
import 'package:marco/images.dart'; import 'package:marco/images.dart';
import 'package:marco/controller/project_controller.dart'; import 'package:marco/controller/project_controller.dart';
import 'package:marco/view/layouts/user_profile_right_bar.dart'; import 'package:marco/view/layouts/user_profile_right_bar.dart';
class Layout extends StatefulWidget { class Layout extends StatefulWidget {
final Widget? child; final Widget? child;
final Widget? floatingActionButton; final Widget? floatingActionButton;
@ -51,8 +52,8 @@ class _LayoutState extends State<Layout> {
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
key: controller.scrollKey, key: controller.scrollKey,
padding: EdgeInsets.symmetric(horizontal: 0, vertical: isMobile ? 16 : 32), padding: EdgeInsets.symmetric(
horizontal: 0, vertical: isMobile ? 16 : 32),
child: widget.child, child: widget.child,
), ),
), ),
@ -64,7 +65,7 @@ class _LayoutState extends State<Layout> {
Widget _buildHeader(BuildContext context, bool isMobile) { Widget _buildHeader(BuildContext context, bool isMobile) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 0), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
child: Obx(() { child: Obx(() {
final isExpanded = projectController.isProjectSelectionExpanded.value; final isExpanded = projectController.isProjectSelectionExpanded.value;
final selectedProjectId = projectController.selectedProjectId?.value; final selectedProjectId = projectController.selectedProjectId?.value;
@ -77,22 +78,14 @@ class _LayoutState extends State<Layout> {
.updateSelectedProject(projectController.projects.first.id); .updateSelectedProject(projectController.projects.first.id);
} }
return AnimatedContainer( return Card(
duration: const Duration(milliseconds: 300), elevation: 4,
decoration: BoxDecoration( shape: RoundedRectangleBorder(
color: Colors.white, borderRadius: BorderRadius.circular(isExpanded ? 16 : 12),
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(isExpanded ? 16 : 0),
), ),
boxShadow: [ margin: EdgeInsets.zero,
BoxShadow( child: Padding(
color: const Color.fromARGB(255, 67, 73, 84), padding: const EdgeInsets.all(10),
blurRadius: 4,
offset: Offset(0, 2),
),
],
),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -110,8 +103,9 @@ class _LayoutState extends State<Layout> {
const SizedBox(width: 12), const SizedBox(width: 12),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () => onTap: () => projectController
projectController.isProjectSelectionExpanded.toggle(), .isProjectSelectionExpanded
.toggle(),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -174,6 +168,7 @@ class _LayoutState extends State<Layout> {
if (isExpanded) _buildProjectList(context, isMobile), if (isExpanded) _buildProjectList(context, isMobile),
], ],
), ),
),
); );
}), }),
); );

View File

@ -4,13 +4,10 @@ import 'package:intl/intl.dart';
import 'package:marco/helpers/theme/app_theme.dart'; import 'package:marco/helpers/theme/app_theme.dart';
import 'package:marco/helpers/utils/mixins/ui_mixin.dart'; import 'package:marco/helpers/utils/mixins/ui_mixin.dart';
import 'package:marco/helpers/utils/my_shadow.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_card.dart';
import 'package:marco/helpers/widgets/my_container.dart'; import 'package:marco/helpers/widgets/my_container.dart';
import 'package:marco/helpers/widgets/my_spacing.dart'; import 'package:marco/helpers/widgets/my_spacing.dart';
import 'package:marco/helpers/widgets/my_text.dart'; import 'package:marco/helpers/widgets/my_text.dart';
import 'package:marco/view/layouts/layout.dart';
import 'package:marco/controller/permission_controller.dart'; import 'package:marco/controller/permission_controller.dart';
import 'package:marco/controller/dashboard/daily_task_controller.dart'; import 'package:marco/controller/dashboard/daily_task_controller.dart';
import 'package:marco/model/dailyTaskPlaning/daily_progress_report_filter.dart'; import 'package:marco/model/dailyTaskPlaning/daily_progress_report_filter.dart';
@ -68,7 +65,53 @@ class _DailyProgressReportScreenState extends State<DailyProgressReportScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Layout( return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(80),
child: AppBar(
backgroundColor: const Color(0xFFF5F5F5),
elevation: 0.5,
foregroundColor: Colors.black,
titleSpacing: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new),
onPressed: () {
Get.offNamed('/dashboard');
},
),
title: Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MyText.titleLarge(
'Daily Task Progress Report',
fontWeight: 700,
color: Colors.black,
),
const SizedBox(height: 4),
GetBuilder<ProjectController>(
builder: (projectController) {
final projectName =
projectController.selectedProject?.name ??
'Select Project';
return MyText.bodySmall(
projectName,
fontWeight: 600,
maxLines: 1,
overflow: TextOverflow.ellipsis,
color: Colors.grey[700],
);
},
),
],
),
),
),
),
body: SafeArea(
child: SingleChildScrollView(
padding: MySpacing.x(0),
child: GetBuilder<DailyTaskController>( child: GetBuilder<DailyTaskController>(
init: dailyTaskController, init: dailyTaskController,
tag: 'daily_progress_report_controller', tag: 'daily_progress_report_controller',
@ -76,7 +119,6 @@ class _DailyProgressReportScreenState extends State<DailyProgressReportScreen>
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_buildHeader(),
MySpacing.height(flexSpacing), MySpacing.height(flexSpacing),
_buildActionBar(), _buildActionBar(),
Padding( Padding(
@ -87,28 +129,10 @@ class _DailyProgressReportScreenState extends State<DailyProgressReportScreen>
); );
}, },
), ),
);
}
Widget _buildHeader() {
return Padding(
padding: MySpacing.x(flexSpacing),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MyText.titleMedium("Daily Progress Report",
fontSize: 18, fontWeight: 600),
MyBreadcrumb(
children: [
MyBreadcrumbItem(name: 'Dashboard'),
MyBreadcrumbItem(name: 'Daily Progress Report', active: true),
],
), ),
],
), ),
); );
} }
Widget _buildActionBar() { Widget _buildActionBar() {
return Padding( return Padding(
padding: MySpacing.x(flexSpacing), padding: MySpacing.x(flexSpacing),

View File

@ -3,12 +3,9 @@ import 'package:get/get.dart';
import 'package:marco/helpers/theme/app_theme.dart'; import 'package:marco/helpers/theme/app_theme.dart';
import 'package:marco/helpers/utils/mixins/ui_mixin.dart'; import 'package:marco/helpers/utils/mixins/ui_mixin.dart';
import 'package:marco/helpers/utils/my_shadow.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_card.dart';
import 'package:marco/helpers/widgets/my_spacing.dart'; import 'package:marco/helpers/widgets/my_spacing.dart';
import 'package:marco/helpers/widgets/my_text.dart'; import 'package:marco/helpers/widgets/my_text.dart';
import 'package:marco/view/layouts/layout.dart';
import 'package:marco/controller/permission_controller.dart'; import 'package:marco/controller/permission_controller.dart';
import 'package:marco/controller/task_planing/daily_task_planing_controller.dart'; import 'package:marco/controller/task_planing/daily_task_planing_controller.dart';
import 'package:marco/controller/project_controller.dart'; import 'package:marco/controller/project_controller.dart';
@ -50,7 +47,54 @@ class _DailyTaskPlaningScreenState extends State<DailyTaskPlaningScreen>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Layout( return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(80),
child: AppBar(
backgroundColor: const Color(0xFFF5F5F5),
elevation: 0.5,
foregroundColor: Colors.black,
titleSpacing: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios_new),
onPressed: () {
Get.offNamed('/dashboard');
},
),
title: Padding(
padding: const EdgeInsets.only(top: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
MyText.titleLarge(
'Daily Task Planning',
fontWeight: 700,
color: Colors.black,
),
const SizedBox(height: 4),
GetBuilder<ProjectController>(
builder: (projectController) {
final projectName =
projectController.selectedProject?.name ??
'Select Project';
return MyText.bodySmall(
projectName,
fontWeight: 600,
maxLines: 1,
overflow: TextOverflow.ellipsis,
color: Colors.grey[700],
);
},
),
],
),
),
),
),
body: SafeArea(
child: SingleChildScrollView(
padding: MySpacing.x(0),
child: GetBuilder<DailyTaskPlaningController>( child: GetBuilder<DailyTaskPlaningController>(
init: dailyTaskPlaningController, init: dailyTaskPlaningController,
tag: 'daily_task_planing_controller', tag: 'daily_task_planing_controller',
@ -58,23 +102,6 @@ class _DailyTaskPlaningScreenState extends State<DailyTaskPlaningScreen>
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding(
padding: MySpacing.x(flexSpacing),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
MyText.titleMedium("Daily Task Planning",
fontSize: 18, fontWeight: 600),
MyBreadcrumb(
children: [
MyBreadcrumbItem(name: 'Dashboard'),
MyBreadcrumbItem(
name: 'Daily Task Planning', active: true),
],
),
],
),
),
MySpacing.height(flexSpacing), MySpacing.height(flexSpacing),
Padding( Padding(
padding: MySpacing.x(flexSpacing), padding: MySpacing.x(flexSpacing),
@ -82,10 +109,7 @@ class _DailyTaskPlaningScreenState extends State<DailyTaskPlaningScreen>
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
const SizedBox(width: 8), const SizedBox(width: 8),
MyText.bodyMedium( MyText.bodyMedium("Refresh", fontWeight: 600),
"Refresh",
fontWeight: 600,
),
Tooltip( Tooltip(
message: 'Refresh Data', message: 'Refresh Data',
child: InkWell( child: InkWell(
@ -107,11 +131,8 @@ class _DailyTaskPlaningScreenState extends State<DailyTaskPlaningScreen>
cursor: SystemMouseCursors.click, cursor: SystemMouseCursors.click,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Icon( child: Icon(Icons.refresh,
Icons.refresh, color: Colors.green, size: 28),
color: Colors.green,
size: 28,
),
), ),
), ),
), ),
@ -127,6 +148,8 @@ class _DailyTaskPlaningScreenState extends State<DailyTaskPlaningScreen>
); );
}, },
), ),
),
),
); );
} }