improvements.

cleaner_module_new_flow
Sikander Saleem 2 months ago
parent 8d60f4c81e
commit d242b190ce

@ -165,7 +165,11 @@ class _CleanerSearchDetailsViewState extends State<CleanerSearchDetailsView> {
if (isValid) { if (isValid) {
if (mounted) { if (mounted) {
getInitialData(); Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (_) => RecurrentWorkOrderView(taskId: widget.requestId)),
);
// getInitialData();
} }
} }
} }

@ -45,8 +45,15 @@ class _CleanerChecklistWidgetState extends State<CleanerChecklistWidget> {
), ),
), ),
16.height, 16.height,
...widget.checklistItems.map((item) => _buildChecklistItem(context, item)).toList(), ListView.separated(
// 16.height, shrinkWrap: true,
padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => _buildChecklistItem(context, widget.checklistItems[index]),
separatorBuilder: (cxt, index) => const Divider().defaultStyle(context),
itemCount: widget.checklistItems.length)
.toShadowContainer(context, padding: 16),
16.height,
_buildImageCaptureWidget(context), _buildImageCaptureWidget(context),
], ],
); );
@ -59,28 +66,21 @@ class _CleanerChecklistWidgetState extends State<CleanerChecklistWidget> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
// Checkbox with title ListTileTheme(
Row( horizontalTitleGap: 0,
children: [ child: Container(
Checkbox( alignment: Alignment.center,
// visualDensity: const VisualDensity(horizontal: -4.0, vertical: -4.0), height: 50.toScreenHeight,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, child: CheckboxListTile(
value: item.isChecked, value: item.isChecked,
controlAffinity: ListTileControlAffinity.leading,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
contentPadding: EdgeInsets.zero,
checkboxScaleFactor: 1.2,
side: BorderSide(color: Colors.black.withValues(alpha: .05)),
visualDensity: const VisualDensity(horizontal: -0.0, vertical: -4.0),
activeColor: AppColor.primary10, activeColor: AppColor.primary10,
onChanged: (bool? value) { title: RichText(
setState(() {
item.isChecked = value ?? false;
if (!item.isChecked) {
item.commentController.clear();
}
});
// Notify parent of changes
widget.onChecklistChanged?.call(widget.checklistItems);
},
),
8.width,
Expanded(
child: RichText(
text: TextSpan( text: TextSpan(
children: [ children: [
TextSpan( TextSpan(
@ -101,13 +101,21 @@ class _CleanerChecklistWidgetState extends State<CleanerChecklistWidget> {
], ],
), ),
), ),
onChanged: (bool? value) {
setState(() {
item.isChecked = value ?? false;
if (!item.isChecked) {
item.commentController.clear();
}
});
// Notify parent of changes
widget.onChecklistChanged?.call(widget.checklistItems);
},
), ),
], ),
), ),
// Comment box - only visible when checked
if (item.isChecked) ...[ if (item.isChecked) ...[
16.height, // 16.height,
AppTextFormField( AppTextFormField(
controller: item.commentController, controller: item.commentController,
labelText: context.translation.comment, labelText: context.translation.comment,
@ -126,7 +134,7 @@ class _CleanerChecklistWidgetState extends State<CleanerChecklistWidget> {
), ),
], ],
], ],
).toShadowContainer(context).paddingOnly(bottom: 16), ),
); );
} }

@ -19,8 +19,9 @@ import 'package:test_sa/views/widgets/total_working_time_detail_bottomsheet.dart
class RecurrentTaskInfoWidget extends StatefulWidget { class RecurrentTaskInfoWidget extends StatefulWidget {
final RecurrentWoData? model; final RecurrentWoData? model;
bool isClosed; bool isClosed;
bool isHouseKeeper;
RecurrentTaskInfoWidget({super.key, required this.model, this.isClosed = false}); RecurrentTaskInfoWidget({super.key, required this.model, this.isClosed = false, this.isHouseKeeper = false});
@override @override
State<RecurrentTaskInfoWidget> createState() => _RecurrentTaskInfoWidgetState(); State<RecurrentTaskInfoWidget> createState() => _RecurrentTaskInfoWidgetState();
@ -81,6 +82,11 @@ class _RecurrentTaskInfoWidgetState extends State<RecurrentTaskInfoWidget> {
'${context.translation.taskNo}: ${widget.model!.taskNo!}'.bodyText2(context).custom(color: AppColor.neutral120), '${context.translation.taskNo}: ${widget.model!.taskNo!}'.bodyText2(context).custom(color: AppColor.neutral120),
'Plan Name: ${widget.model?.planRecurrent?.planName ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120), 'Plan Name: ${widget.model?.planRecurrent?.planName ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.site}: ${widget.model!.site!.siteName!}'.bodyText2(context).custom(color: AppColor.neutral120), '${context.translation.site}: ${widget.model!.site!.siteName!}'.bodyText2(context).custom(color: AppColor.neutral120),
if (widget.isHouseKeeper) ...[
'${context.translation.department}: ${widget.model!.department?.name ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.floor}: ${widget.model!.floor?.name ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.room}: ${widget.model!.room?.name ?? "-"}'.bodyText2(context).custom(color: AppColor.neutral120),
],
'${context.translation.assignedEmployee}: ${widget.model!.engineer!.userName ?? ""}'.bodyText2(context).custom(color: AppColor.neutral120), '${context.translation.assignedEmployee}: ${widget.model!.engineer!.userName ?? ""}'.bodyText2(context).custom(color: AppColor.neutral120),
'${context.translation.scheduledDate}: ${widget.model!.scheduleDate!.toMonthYearFormat}'.bodyText2(context).custom(color: AppColor.neutral120), '${context.translation.scheduledDate}: ${widget.model!.scheduleDate!.toMonthYearFormat}'.bodyText2(context).custom(color: AppColor.neutral120),
], ],
@ -91,16 +97,20 @@ class _RecurrentTaskInfoWidgetState extends State<RecurrentTaskInfoWidget> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildingInfoWidget(label: context.translation.department, value: widget.model!.department?.name?.cleanupWhitespace.capitalizeFirstOfEach, context: context) if (!widget.isHouseKeeper) ...[
.ignorePointer(widget.isClosed), buildingInfoWidget(label: context.translation.department, value: widget.model!.department?.name?.cleanupWhitespace.capitalizeFirstOfEach, context: context)
8.height, .ignorePointer(widget.isClosed),
buildingInfoWidget(label: context.translation.floor, value: widget.model!.floor?.name?.cleanupWhitespace.capitalizeFirstOfEach, context: context).ignorePointer(widget.isClosed), 8.height,
8.height, buildingInfoWidget(label: context.translation.floor, value: widget.model!.floor?.name?.cleanupWhitespace.capitalizeFirstOfEach, context: context).ignorePointer(widget.isClosed),
buildingInfoWidget(label: context.translation.room, value: widget.model!.room?.name?.cleanupWhitespace.capitalizeFirstOfEach, context: context).ignorePointer(widget.isClosed), 8.height,
8.height, buildingInfoWidget(label: context.translation.room, value: widget.model!.room?.name?.cleanupWhitespace.capitalizeFirstOfEach, context: context).ignorePointer(widget.isClosed),
8.height,
],
_timerWidget(context, totalWorkingHours), _timerWidget(context, totalWorkingHours),
8.height, if (!widget.isHouseKeeper) ...[
_commentWidget(context: context, model: widget.model).ignorePointer(widget.isClosed), 8.height,
_commentWidget(context: context, model: widget.model).ignorePointer(widget.isClosed),
],
], ],
// ], // ],
).toShadowContainer(context, padding: 12) ).toShadowContainer(context, padding: 12)

@ -56,6 +56,7 @@ class _RecurrentWorkOrderViewState extends State<RecurrentWorkOrderView> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<AllRequestsProvider>(builder: (context, requestProvider, child) { return Consumer<AllRequestsProvider>(builder: (context, requestProvider, child) {
isClosed = requestProvider.recurrentWoData?.status?.value == 1; isClosed = requestProvider.recurrentWoData?.status?.value == 1;
bool isHouseKeeper = requestProvider.recurrentWoData!.planRecurrentTaskCheckLists != null && requestProvider.recurrentWoData!.planRecurrentTaskCheckLists!.isNotEmpty;
return Scaffold( return Scaffold(
appBar: DefaultAppBar( appBar: DefaultAppBar(
title: context.translation.recurrentWo, title: context.translation.recurrentWo,
@ -77,7 +78,7 @@ class _RecurrentWorkOrderViewState extends State<RecurrentWorkOrderView> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
RecurrentTaskInfoWidget(isClosed: isClosed,model: requestProvider.recurrentWoData), RecurrentTaskInfoWidget(isClosed: isClosed, model: requestProvider.recurrentWoData, isHouseKeeper: isHouseKeeper),
IgnorePointer( IgnorePointer(
ignoring: isClosed, ignoring: isClosed,
child: requestProvider.recurrentWoData!.planRecurrentMedicalTaskRooms != null && requestProvider.recurrentWoData!.planRecurrentMedicalTaskRooms!.isNotEmpty child: requestProvider.recurrentWoData!.planRecurrentMedicalTaskRooms != null && requestProvider.recurrentWoData!.planRecurrentMedicalTaskRooms!.isNotEmpty
@ -90,7 +91,7 @@ class _RecurrentWorkOrderViewState extends State<RecurrentWorkOrderView> {
: const SizedBox(), : const SizedBox(),
), ),
16.height, 16.height,
requestProvider.recurrentWoData!.planRecurrentTaskCheckLists != null && requestProvider.recurrentWoData!.planRecurrentTaskCheckLists!.isNotEmpty isHouseKeeper
? CleanerChecklistWidget( ? CleanerChecklistWidget(
isClosed: isClosed, isClosed: isClosed,
checklistItems: requestProvider.recurrentWoData!.planRecurrentTaskCheckLists ?? [], checklistItems: requestProvider.recurrentWoData!.planRecurrentTaskCheckLists ?? [],

Loading…
Cancel
Save