Merge remote-tracking branch 'origin/export_module_ui_ux_enhancement' into export_module_ui_ux_enhancement

main_production_RSG
Sikander Saleem 2 months ago
commit 0463d1c367

@ -119,6 +119,7 @@ class _AssetInventoryFormViewState extends State<AssetInventoryFormView> {
if ((!isRegistered && widget.sessionTypeValue == 1) || (widget.sessionTypeValue == 3) || (!isRegistered && widget.sessionTypeValue == 2)) ...[ if ((!isRegistered && widget.sessionTypeValue == 1) || (widget.sessionTypeValue == 3) || (!isRegistered && widget.sessionTypeValue == 2)) ...[
AssetPicker( AssetPicker(
showLoading: false, showLoading: false,
overWriteStyle: true,
labelColor: AppColor.white936, labelColor: AppColor.white936,
iconColor: AppColor.neutral120, iconColor: AppColor.neutral120,
label: 'Scan Asset'.addTranslation, label: 'Scan Asset'.addTranslation,

@ -244,6 +244,7 @@ class _CreateCMRequestState extends State<CreateCMRequest> with TickerProviderSt
Widget scanAssetButton() { Widget scanAssetButton() {
return AssetPicker( return AssetPicker(
device: _serviceRequest.device, device: _serviceRequest.device,
overWriteStyle: true,
showLoading: checkPendingRequest, showLoading: checkPendingRequest,
// borderColor: AppColor.black20, // borderColor: AppColor.black20,
onPick: (asset) async { onPick: (asset) async {

@ -789,8 +789,11 @@ class ServiceRequestBottomSheet {
AppFilledButton( AppFilledButton(
label: context.translation.no, label: context.translation.no,
loading: false, loading: false,
buttonColor: AppColor.white60, showBorder: true,
textColor: AppColor.black10, buttonColor: context.isDark ? AppColor.neutral70 : AppColor.white60,
textColor: context.isDark ? AppColor.white10 : AppColor.black10,
// buttonColor: AppColor.white60,
// textColor: AppColor.black10,
onPressed: () async { onPressed: () async {
Navigator.pop(context); Navigator.pop(context);
}, },

@ -149,7 +149,7 @@ class EmployeeCard extends StatelessWidget {
children: [ children: [
ServiceReportAssistantEmployeeMenu( ServiceReportAssistantEmployeeMenu(
title: context.translation.select, title: context.translation.select,
backgroundColor: AppColor.fieldBgColor(context), // backgroundColor: AppColor.fieldBgColor(context),
assetId: assetId, assetId: assetId,
initialValue: model.employee, initialValue: model.employee,
onSelect: (employee) { onSelect: (employee) {

@ -61,7 +61,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
SingleItemDropDownMenu<SupplierDetails, VendorProvider>( SingleItemDropDownMenu<SupplierDetails, VendorProvider>(
context: context, context: context,
title: context.translation.supplier, title: context.translation.supplier,
backgroundColor: AppColor.fieldBgColor(context), // backgroundColor: AppColor.fieldBgColor(context),
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplier, initialValue: requestDetailProvider.activityMaintenanceHelperModel?.supplier,
showAsBottomSheet: true, showAsBottomSheet: true,
showShadow: false, showShadow: false,
@ -77,7 +77,8 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
children: [ children: [
SingleItemDropDownMenu<SuppPersons, NullableLoadingProvider>( SingleItemDropDownMenu<SuppPersons, NullableLoadingProvider>(
context: context, context: context,
backgroundColor: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context), backgroundColor:
requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.disableFieldBackground(context) : AppColor.fieldBgColor(context),
title: context.translation.supplierEngineer, title: context.translation.supplierEngineer,
showShadow: false, showShadow: false,
enabled: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.isNotEmpty ?? false, enabled: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.isNotEmpty ?? false,
@ -108,7 +109,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
width: 60.toScreenWidth, width: 60.toScreenWidth,
decoration: BoxDecoration( decoration: BoxDecoration(
// color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100, // color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.neutral40 : AppColor.neutral100,
color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? context.isDark ? AppColor.neutral20 : AppColor.neutral40 : AppColor.fieldBgColor(context), color: requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppliername == null ? AppColor.disableFieldBackground(context) : AppColor.fieldBgColor(context),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
//boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], //boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
), ),
@ -120,8 +121,12 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
context: context, context: context,
useSafeArea: true, useSafeArea: true,
isScrollControlled: true, isScrollControlled: true,
backgroundColor: Colors.transparent, isDismissible: true,
builder: (context) => AddSupplierEngineerBottomSheet(requestDetailProvider.activityMaintenanceHelperModel!.supplier!.id!.toInt()), backgroundColor: AppColor.bottomSheetColor(context),
// useSafeArea: true,
// isScrollControlled: true,
// backgroundColor: Colors.transparent,
builder: (context) => AddSupplierEngineerBottomSheet(requestDetailProvider.activityMaintenanceHelperModel!.supplier!.id!.toInt()).bottomSheetContainer(context),
)) as SuppEngineerWorkOrders; )) as SuppEngineerWorkOrders;
requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons ??= []; requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons ??= [];
requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.add(SuppPersons.fromJson(suppEngineer.toJson())); requestDetailProvider.activityMaintenanceHelperModel?.supplier?.suppPersons?.add(SuppPersons.fromJson(suppEngineer.toJson()));
@ -137,7 +142,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
ADatePicker( ADatePicker(
label: context.translation.startTime, label: context.translation.startTime,
hideShadow: true, hideShadow: true,
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime, date: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime,
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
formatDateWithTime: true, formatDateWithTime: true,
@ -179,10 +184,10 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
ADatePicker( ADatePicker(
label: context.translation.endTime, label: context.translation.endTime,
hideShadow: true, hideShadow: true,
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
to: DateTime.now(), to: DateTime.now(),
enable: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime != null, enable: requestDetailProvider.activityMaintenanceHelperModel?.supplierStartTime != null,
date: requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime, date: requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime,
formatDateWithTime: true, formatDateWithTime: true,
onDatePicker: (selectedDate) { onDatePicker: (selectedDate) {
@ -199,8 +204,6 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
// return; // return;
// } // }
selectedDate = selectedDate.add(Duration(hours: selectedTime.hour, minutes: selectedTime.minute)); selectedDate = selectedDate.add(Duration(hours: selectedTime.hour, minutes: selectedTime.minute));
bool isBeforeCurrentTime = selectedDate.isBefore(DateTime.now()); bool isBeforeCurrentTime = selectedDate.isBefore(DateTime.now());
bool isAfterStartTime = selectedDate.isAfter(requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!); bool isAfterStartTime = selectedDate.isAfter(requestDetailProvider.activityMaintenanceHelperModel!.supplierStartTime!);
@ -219,10 +222,6 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
// return; // return;
// } // }
requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime = selectedDate; requestDetailProvider.activityMaintenanceHelperModel?.supplierEndTime = selectedDate;
requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel); requestDetailProvider.updateActivityMaintenanceHelperModel(requestDetailProvider.activityMaintenanceHelperModel);
CMRequestUtils.calculateAndAssignWorkingHours( CMRequestUtils.calculateAndAssignWorkingHours(
@ -242,7 +241,7 @@ class _ExternalMaintenanceRequestState extends State<ExternalMaintenanceRequest>
8.height, 8.height,
AppTextFormField( AppTextFormField(
labelText: context.translation.workingHours, labelText: context.translation.workingHours,
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
controller: _workingHoursController, controller: _workingHoursController,
suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16), suffixIcon: "clock".toSvgAsset(width: 20, color: context.isDark ? AppColor.neutral10 : null).paddingOnly(end: 16),
initialValue: initialValue:

@ -162,7 +162,6 @@ class _InternalMaintenanceRequestState extends State<InternalMaintenanceRequest>
16.height, 16.height,
AppTextFormField( AppTextFormField(
labelText: context.translation.assignedEmployee, labelText: context.translation.assignedEmployee,
backgroundColor: AppColor.fieldBgColor(context),
initialValue: requestDetailProvider.activityMaintenanceHelperModel?.assignedEmployee?.userName, initialValue: requestDetailProvider.activityMaintenanceHelperModel?.assignedEmployee?.userName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
labelStyle: AppTextStyles.textFieldLabelStyle, labelStyle: AppTextStyles.textFieldLabelStyle,

@ -28,6 +28,7 @@ import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart'; import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
import 'package:test_sa/providers/loading_list_notifier.dart'; import 'package:test_sa/providers/loading_list_notifier.dart';
import 'package:test_sa/views/widgets/images/multi_image_picker.dart'; import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
import 'package:test_sa/views/widgets/item_views/info_text_widget.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart'; import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
class SparePartRequest extends StatefulWidget { class SparePartRequest extends StatefulWidget {
@ -158,7 +159,7 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
showAsBottomSheet: true, showAsBottomSheet: true,
loading: _isLoading, loading: _isLoading,
initialValue: requestDetailProvider.sparePartHelperModel?.sparePart, initialValue: requestDetailProvider.sparePartHelperModel?.sparePart,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
onSelect: (part) async { onSelect: (part) async {
if (part != null) { if (part != null) {
requestDetailProvider.sparePartHelperModel?.sparePart = part; requestDetailProvider.sparePartHelperModel?.sparePart = part;
@ -181,18 +182,15 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
decorationColor: AppColor.primary10, decorationColor: AppColor.primary10,
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
)).onPress( )).onPress(
() async { () async {
requestDetailProvider.getStoreAvailabilityById(partId: requestDetailProvider.sparePartHelperModel?.sparePart?.id); requestDetailProvider.getStoreAvailabilityById(partId: requestDetailProvider.sparePartHelperModel?.sparePart?.id);
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
useSafeArea: true,
isScrollControlled: true, isScrollControlled: true,
shape: const RoundedRectangleBorder( isDismissible: true,
borderRadius: BorderRadius.vertical( backgroundColor: AppColor.bottomSheetColor(context),
top: Radius.circular(20), builder: (BuildContext context) => PartDetailBottomSheetSheet().bottomSheetContainer(context),
),
),
clipBehavior: Clip.antiAliasWithSaveLayer,
builder: (BuildContext context) => PartDetailBottomSheetSheet(),
); );
}, },
), ),
@ -204,14 +202,14 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
labelText: context.translation.quantity, labelText: context.translation.quantity,
textInputType: TextInputType.number, textInputType: TextInputType.number,
labelStyle: AppTextStyles.textFieldLabelStyle, labelStyle: AppTextStyles.textFieldLabelStyle,
showWithoutDecoration: true, // showWithoutDecoration: true,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null, enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null,
validator: (value) => value == null || value.isEmpty validator: (value) => value == null || value.isEmpty
? context.translation.requiredField ? context.translation.requiredField
: Validator.isNumeric(value) : Validator.isNumeric(value)
? null ? null
: context.translation.onlyNumbers, : context.translation.onlyNumbers,
onChange: (value) { onChange: (value) {
requestDetailProvider.sparePartHelperModel?.quantity = num.tryParse(value ?? ""); requestDetailProvider.sparePartHelperModel?.quantity = num.tryParse(value ?? "");
}, },
@ -226,14 +224,14 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
labelText: context.translation.installedQty, labelText: context.translation.installedQty,
textInputType: const TextInputType.numberWithOptions(decimal: true), textInputType: const TextInputType.numberWithOptions(decimal: true),
labelStyle: AppTextStyles.textFieldLabelStyle, labelStyle: AppTextStyles.textFieldLabelStyle,
showWithoutDecoration: true, // showWithoutDecoration: true,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null, enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null,
validator: (value) => value == null || value.isEmpty validator: (value) => value == null || value.isEmpty
? context.translation.requiredField ? context.translation.requiredField
: Validator.isNumeric(value) : Validator.isNumeric(value)
? null ? null
: context.translation.onlyNumbers, : context.translation.onlyNumbers,
onChange: (value) { onChange: (value) {
requestDetailProvider.sparePartHelperModel?.installQty = num.tryParse(value ?? ""); requestDetailProvider.sparePartHelperModel?.installQty = num.tryParse(value ?? "");
}, },
@ -247,14 +245,14 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
labelText: context.translation.returnQty, labelText: context.translation.returnQty,
textInputType: TextInputType.number, textInputType: TextInputType.number,
labelStyle: AppTextStyles.textFieldLabelStyle, labelStyle: AppTextStyles.textFieldLabelStyle,
showWithoutDecoration: true, // showWithoutDecoration: true,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null, enable: requestDetailProvider.sparePartHelperModel?.sparePart?.id != null,
validator: (value) => value == null || value.isEmpty validator: (value) => value == null || value.isEmpty
? context.translation.requiredField ? context.translation.requiredField
: Validator.isNumeric(value) : Validator.isNumeric(value)
? null ? null
: context.translation.onlyNumbers, : context.translation.onlyNumbers,
onChange: (value) { onChange: (value) {
requestDetailProvider.sparePartHelperModel?.returnQty = num.tryParse(value ?? ""); requestDetailProvider.sparePartHelperModel?.returnQty = num.tryParse(value ?? "");
}, },
@ -269,8 +267,8 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
controller: _oracleNoController, controller: _oracleNoController,
labelText: context.translation.oracleNo, labelText: context.translation.oracleNo,
textInputType: TextInputType.number, textInputType: TextInputType.number,
showWithoutDecoration: true, // showWithoutDecoration: true,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, backgroundColor: AppColor.disableFieldBackground(context),
enable: false, enable: false,
), ),
12.height, 12.height,
@ -279,10 +277,10 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
labelStyle: AppTextStyles.textFieldLabelStyle, labelStyle: AppTextStyles.textFieldLabelStyle,
controller: _descriptionController, controller: _descriptionController,
showSpeechToText: true, showSpeechToText: true,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, // backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90,
labelText: "Engineer Comment", labelText: "Engineer Comment",
alignLabelWithHint: true, alignLabelWithHint: true,
showWithoutDecoration: true, // showWithoutDecoration: true,
textInputType: TextInputType.multiline, textInputType: TextInputType.multiline,
onChange: (value) { onChange: (value) {
requestDetailProvider.sparePartHelperModel?.comment = value; requestDetailProvider.sparePartHelperModel?.comment = value;
@ -309,12 +307,12 @@ class _SparePartRequestState extends State<SparePartRequest> with TickerProvider
FooterActionButton.footerContainer( FooterActionButton.footerContainer(
context: context, context: context,
child: AppFilledButton( child: AppFilledButton(
label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity, label: _requestDetailProvider?.sparePartHelperModel?.id == 0 ? context.translation.addSparePartActivity : context.translation.updateSparePartActivity,
buttonColor: AppColor.green70, buttonColor: AppColor.green70,
onPressed: () { onPressed: () {
_onSubmit(requestDetailProvider: requestDetailProvider); _onSubmit(requestDetailProvider: requestDetailProvider);
}, },
)), )),
], ],
), ),
); );
@ -390,7 +388,7 @@ class PartDetailBottomSheetSheet extends StatelessWidget {
: requestDetailProvider.storeAvailability.isEmpty : requestDetailProvider.storeAvailability.isEmpty
? const NoDataFound().center ? const NoDataFound().center
: ListView.separated( : ListView.separated(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.only(top: 12),
itemCount: requestDetailProvider.storeAvailability.length, itemCount: requestDetailProvider.storeAvailability.length,
separatorBuilder: (czt, index) => 12.height, separatorBuilder: (czt, index) => 12.height,
itemBuilder: (context, index) { itemBuilder: (context, index) {
@ -406,12 +404,9 @@ class PartDetailBottomSheetSheet extends StatelessWidget {
Widget partAvailableQuantityCard({required StoreAvailability model, required BuildContext context}) { Widget partAvailableQuantityCard({required StoreAvailability model, required BuildContext context}) {
return Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ return Column(mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [
'Site Name: ${model.siteName ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120), InfoTextWidget(label: "Site Name:".addTranslation, value: model.siteName ?? ''),
8.height, InfoTextWidget(label: "Store Name:".addTranslation, value: model.storeName ?? ''),
'Store Name: ${model.storeName ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120), InfoTextWidget(label: "Available Quantity:".addTranslation, value: model.availablityQty != null ? model.availablityQty.toString() : ''),
8.height, ]).toShadowContainer(context, padding: 12, showShadow: false,);
'Available Quantity: ${model.availablityQty ?? ''}'.bodyText2(context).custom(color: AppColor.neutral120),
8.height,
]).toShadowContainer(context, padding: 12, showShadow: false, backgroundColor: AppColor.neutral110);
} }
} }

@ -122,8 +122,10 @@ class _CreateIncidentRequestPageState extends State<CreateIncidentRequestPage> {
8.height, 8.height,
AssetPicker( AssetPicker(
device: device, device: device,
overWriteStyle: true,
showLoading: false, showLoading: false,
borderColor: AppColor.black20, borderColor: AppColor.black20,
showBorder: true,
onPick: (asset) async { onPick: (asset) async {
device = asset; device = asset;
payload["assetId"] = asset.modelDefinition?.id; payload["assetId"] = asset.modelDefinition?.id;

@ -71,6 +71,7 @@ class _CreateEquipmentInternalAuditFormState extends State<CreateEquipmentIntern
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AssetPicker( AssetPicker(
overWriteStyle: true,
device: _equipmentinternalAuditModel.device, device: _equipmentinternalAuditModel.device,
borderColor: AppColor.black20, borderColor: AppColor.black20,
buttonColor: AppColor.white936, buttonColor: AppColor.white936,

@ -124,6 +124,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
AssetPicker( AssetPicker(
overWriteStyle: true,
device: _pickedAsset, device: _pickedAsset,
showLoading: false, showLoading: false,
// borderColor: AppColor.black20, // borderColor: AppColor.black20,

@ -94,8 +94,8 @@ class _CreateTaskViewState extends State<CreateTaskView> with TickerProviderStat
), ),
8.height, 8.height,
taskTypeWidget(selectedType?.relatedTo?.value), taskTypeWidget(selectedType?.relatedTo?.value),
8.height,
if (selectedType != null && selectedType!.isRecallAndAlert!) ...[ if (selectedType != null && selectedType!.isRecallAndAlert!) ...[
8.height,
recallAndAlert(), recallAndAlert(),
], ],
8.height, 8.height,
@ -408,10 +408,13 @@ class _CreateTaskViewState extends State<CreateTaskView> with TickerProviderStat
Widget scanAssetButton() { Widget scanAssetButton() {
return selectedType?.linkWithMultiAssets == true return selectedType?.linkWithMultiAssets == true
? AssetPicker( ? AssetPicker(
overWriteStyle: true,
deviceList: _deviceList, deviceList: _deviceList,
showLoading: false, showLoading: false,
borderColor: AppColor.black20, borderColor: AppColor.border2Color(context),
buttonColor: AppColor.white936, showBorder: true,
// buttonColor: AppColor.white936,
buttonColor: AppColor.dropDownBackground(context),
multiSelection: true, multiSelection: true,
onAssetRemove: (itemId) { onAssetRemove: (itemId) {
_deviceList.removeWhere((asset) => asset.id?.toInt() == itemId); _deviceList.removeWhere((asset) => asset.id?.toInt() == itemId);
@ -427,6 +430,7 @@ class _CreateTaskViewState extends State<CreateTaskView> with TickerProviderStat
) )
: AssetPicker( : AssetPicker(
device: device, device: device,
overWriteStyle: true,
showLoading: false, showLoading: false,
borderColor: AppColor.black20, borderColor: AppColor.black20,
onPick: (asset) async { onPick: (asset) async {

@ -155,6 +155,7 @@ class _CreateTRAFRequestPageState extends State<CreateTRAFRequestPage> {
if (requestType?.value == 2) ...[ if (requestType?.value == 2) ...[
12.height, 12.height,
AssetPicker( AssetPicker(
overWriteStyle: true,
device: asset, device: asset,
editable: false, editable: false,
showLoading: false, showLoading: false,

@ -122,6 +122,7 @@ class _UpdateTrafRequestPageState extends State<UpdateTrafRequestPage> {
if (requestType?.id == 733) ...[ if (requestType?.id == 733) ...[
12.height, 12.height,
AssetPicker( AssetPicker(
overWriteStyle: true,
device: asset, device: asset,
editable: false, editable: false,
showLoading: false, showLoading: false,
@ -163,6 +164,7 @@ class _UpdateTrafRequestPageState extends State<UpdateTrafRequestPage> {
), ),
8.height, 8.height,
AssetPicker( AssetPicker(
overWriteStyle: true,
deviceList: _deviceList, deviceList: _deviceList,
showLoading: false, showLoading: false,
borderColor: AppColor.black20, borderColor: AppColor.black20,
@ -229,8 +231,7 @@ class _UpdateTrafRequestPageState extends State<UpdateTrafRequestPage> {
onPressed: () { onPressed: () {
trafRequest.attachments = []; trafRequest.attachments = [];
for (var item in attachments) { for (var item in attachments) {
String fileName = String fileName = CMRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
CMRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
trafRequest.attachments!.add( trafRequest.attachments!.add(
Attachments(id: item.id, trafId: item.id, attachmentName: fileName), Attachments(id: item.id, trafId: item.id, attachmentName: fileName),
); );

@ -132,6 +132,8 @@ class AppColor {
static Color dropDownBackground(BuildContext context) => context.isDark ? dropDownDark : backgroundLight; static Color dropDownBackground(BuildContext context) => context.isDark ? dropDownDark : backgroundLight;
static Color disableFieldBackground(BuildContext context) => context.isDark ? neutral60 : neutral40;
static Color scaffold2Background(BuildContext context) => context.isDark ? backgroundDark : white20; static Color scaffold2Background(BuildContext context) => context.isDark ? backgroundDark : white20;
static Color assetGroupBackground(BuildContext context) => context.isDark ? containerDark : Colors.white30; static Color assetGroupBackground(BuildContext context) => context.isDark ? containerDark : Colors.white30;

@ -214,12 +214,13 @@ class _AppTextFormFieldState extends State<AppTextFormField> {
filled: !widget.isBackgroundTransparent, filled: !widget.isBackgroundTransparent,
fillColor: widget.isBackgroundTransparent fillColor: widget.isBackgroundTransparent
? null ? null
: (context.isDark && !widget.enable : !widget.enable?AppColor.disableFieldBackground(context):AppColor.dropDownBackground(context),
? AppColor.neutral50 // (context.isDark && !widget.enable
: !widget.enable // ? AppColor.neutral50
? (widget.enableColor ?? AppColor.disableDark) // : !widget.enable
: AppColor.dropDownBackground(context)), // ? (widget.enableColor ?? AppColor.disableDark)
errorStyle: AppTextStyle.tiny.copyWith(color: AppColor.red30), // : AppColor.dropDownBackground(context)),
errorStyle: AppTextStyle.tiny.copyWith(color: context.isDark ? AppColor.red50 : AppColor.red30),
// floatingLabelStyle: widget.floatingLabelStyle ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20), // floatingLabelStyle: widget.floatingLabelStyle ?? AppTextStyle.body1.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.neutral20),

@ -5,6 +5,7 @@ import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart'; import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/views/widgets/item_views/info_header_widget.dart';
class InfoContent { class InfoContent {
final String? title; final String? title;
@ -40,10 +41,11 @@ class InfoDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Text( child: InfoHeader16Widget("Information").paddingOnly(top: 16),
title ?? "Information", // Text(
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96), // title ?? "Information",
).paddingOnly(top: 16), // style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: AppColor.headingTextColor(context), height: 35 / 24, letterSpacing: -0.96),
// ).paddingOnly(top: 16),
), ),
IconButton( IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -55,7 +57,12 @@ class InfoDialog extends StatelessWidget {
) )
], ],
), ),
message != null ? message!.bodyText(context).custom(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20) : const SizedBox(), message != null
? Text(
message!,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context)),
)
: const SizedBox(),
8.height, 8.height,
ListView.separated( ListView.separated(
shrinkWrap: true, shrinkWrap: true,
@ -63,9 +70,13 @@ class InfoDialog extends StatelessWidget {
itemBuilder: (cxt, index) => RichText( itemBuilder: (cxt, index) => RichText(
text: TextSpan( text: TextSpan(
text: "${content[index].title}: ", text: "${content[index].title}: ",
style: AppTextStyles.heading6.copyWith(fontWeight: FontWeight.w600, color: AppColor.textColor(context)), //
style: AppTextStyles.heading6.copyWith(color: AppColor.textStyleColor(context), fontSize: 14),
children: [ children: [
TextSpan(text: content[index].message, style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20)), TextSpan(
text: content[index].message,
style: AppTextStyles.bodyText2.copyWith(color: AppColor.lightTextColor(context), fontWeight: FontWeight.normal),
),
], ],
), ),
), ),

@ -21,7 +21,17 @@ class SwipeSuccessView extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
'swipe_success'.toSvgAsset(), // 'swipe_success'.toSvgAsset(),
Container(
padding: const EdgeInsets.all(20),
width: 150.toScreenWidth,
height: 150.toScreenHeight,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.background(context),
),
child: 'swipe'.toSvgAsset(width: 24, height: 24, color: AppColor.green70),
),
17.height, 17.height,
Text( Text(
context.translation.successful, context.translation.successful,

@ -46,106 +46,92 @@ class _AddSupplierEngineerBottomSheetState extends State<AddSupplierEngineerBott
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
return Wrap( return Wrap(
children: [ children: [
Container( Form(
clipBehavior: Clip.antiAlias, key: _formKey,
margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: SingleChildScrollView(
decoration: BoxDecoration( child: Column(
color: Theme.of(context).scaffoldBackgroundColor, children: [
borderRadius: const BorderRadius.only(topRight: Radius.circular(20), topLeft: Radius.circular(20)), Container(
), width: 40.toScreenWidth,
padding: EdgeInsets.only( height: 5.toScreenHeight,
left: 16.toScreenWidth, decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)),
right: 16.toScreenHeight, ),
top: 8.toScreenHeight, Align(
bottom: MediaQuery.of(context).viewInsets.bottom + MediaQuery.of(context).padding.bottom, alignment: AlignmentDirectional.centerStart,
), child: "Add Engineer For Supplier".heading5(context).custom(fontWeight: FontWeight.w600).paddingOnly(top: 16, bottom: 16),
child: Form( ),
key: _formKey, 8.height,
child: SingleChildScrollView( AppTextFormField(
child: Column( labelText: "Engineer Supplier Name".addTranslation,
children: [ textInputType: TextInputType.name,
Container( onChange: (text) {
width: 40.toScreenWidth, engineer.personName = text.isEmpty ? null : text;
height: 5.toScreenHeight, },
decoration: BoxDecoration(color: AppColor.neutral40, borderRadius: BorderRadius.circular(30)), onSaved: (text) {
), engineer.personName = text.isEmpty ? null : text;
Align( },
alignment: AlignmentDirectional.centerStart, ),
child: "Add Engineer For Supplier".heading5(context).custom(fontWeight: FontWeight.w600).paddingOnly(top: 16, bottom: 16), 8.height,
), SingleItemDropDownMenu<Lookup, SupplierEngineerProvider>(
8.height, context: context,
AppTextFormField( title: "Role",
labelText: "Engineer Supplier Name".addTranslation, initialValue: suppEngRole,
textInputType: TextInputType.name, onSelect: (value) {
onChange: (text) { if (value != null) {
engineer.personName = text.isEmpty ? null : text; suppEngRole = value;
}, }
onSaved: (text) { },
engineer.personName = text.isEmpty ? null : text; ),
}, 8.height,
), AppTextFormField(
8.height, labelText: "Contact".addTranslation,
SingleItemDropDownMenu<Lookup, SupplierEngineerProvider>( textInputType: TextInputType.name,
context: context, onChange: (text) {
title: "Role", engineer.contact = text.isEmpty ? null : text;
initialValue: suppEngRole, },
onSelect: (value) { onSaved: (text) {
if (value != null) { engineer.contact = text.isEmpty ? null : text;
suppEngRole = value; },
} ),
}, 8.height,
), AppTextFormField(
8.height, labelText: "Email".addTranslation,
AppTextFormField( textInputType: TextInputType.emailAddress,
labelText: "Contact".addTranslation, onChange: (text) {
textInputType: TextInputType.name, engineer.email = text.isEmpty ? null : text;
onChange: (text) { },
engineer.contact = text.isEmpty ? null : text; onSaved: (text) {
}, engineer.email = text.isEmpty ? null : text;
onSaved: (text) { },
engineer.contact = text.isEmpty ? null : text; ),
}, 8.height,
), 16.height,
8.height, Consumer<ServiceRequestsProvider>(
AppTextFormField( builder: (context, snapshot, _) => AppFilledButton(
labelText: "Email".addTranslation, label: context.translation.save,
textInputType: TextInputType.emailAddress, loading: snapshot.isLoading ?? false,
onChange: (text) { onPressed: () async {
engineer.email = text.isEmpty ? null : text; _formKey.currentState!.save();
},
onSaved: (text) {
engineer.email = text.isEmpty ? null : text;
},
),
8.height,
16.height,
Consumer<ServiceRequestsProvider>(
builder: (context, snapshot, _) => AppFilledButton(
label: context.translation.save,
loading: snapshot.isLoading ?? false,
onPressed: () async {
_formKey.currentState!.save();
if (engineer.personName?.isEmpty ?? true) { if (engineer.personName?.isEmpty ?? true) {
"Engineer supplier name is empty".showToast; "Engineer supplier name is empty".showToast;
return; return;
} }
engineer.personRoleId = suppEngRole?.id; engineer.personRoleId = suppEngRole?.id;
SuppEngineerWorkOrders? suppEngineer = await snapshot.addSupplierEngineer(engineer); SuppEngineerWorkOrders? suppEngineer = await snapshot.addSupplierEngineer(engineer);
if (suppEngineer == null) { if (suppEngineer == null) {
Fluttertoast.showToast(msg: context.translation.failedToCompleteRequest); Fluttertoast.showToast(msg: context.translation.failedToCompleteRequest);
return; return;
} }
Fluttertoast.showToast(msg: context.translation.successfulRequestMessage); Fluttertoast.showToast(msg: context.translation.successfulRequestMessage);
Navigator.pop(context, suppEngineer); Navigator.pop(context, suppEngineer);
}, },
),
), ),
16.height, ),
], 16.height,
), ],
), ),
), ),
) )

@ -43,11 +43,7 @@ class ADatePicker extends StatelessWidget {
return Container( return Container(
height: height, height: height,
decoration: BoxDecoration( decoration: BoxDecoration(
color: (context.isDark && !enable color: !enable ? AppColor.disableFieldBackground(context) : AppColor.dropDownBackground(context),
? AppColor.neutral50
: !enable
? AppColor.neutral40
: AppColor.background(context)),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
border: withBorder ? Border.all(width: 1, color: AppColor.border2Color(context)) : const Border(), border: withBorder ? Border.all(width: 1, color: AppColor.border2Color(context)) : const Border(),
boxShadow: hideShadow ? null : [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], boxShadow: hideShadow ? null : [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
@ -96,6 +92,8 @@ class ADatePicker extends StatelessWidget {
headerBackgroundColor: AppColor.primary10, headerBackgroundColor: AppColor.primary10,
headerForegroundColor: Colors.white, headerForegroundColor: Colors.white,
subHeaderForegroundColor: AppColor.textColor(context),
// Background // Background
backgroundColor: AppColor.bottomSheetColor(context), backgroundColor: AppColor.bottomSheetColor(context),
@ -135,7 +133,7 @@ class ADatePicker extends StatelessWidget {
return Colors.transparent; return Colors.transparent;
}), }),
todayBorder: BorderSide(color: AppColor.primary10, width: 1), todayBorder: const BorderSide(color: AppColor.primary10, width: 1),
// Year selector styling // Year selector styling
yearForegroundColor: WidgetStateColor.resolveWith((states) { yearForegroundColor: WidgetStateColor.resolveWith((states) {
@ -181,7 +179,7 @@ class ADatePicker extends StatelessWidget {
// Input decoration for text field mode // Input decoration for text field mode
inputDecorationTheme: InputDecorationTheme( inputDecorationTheme: InputDecorationTheme(
focusedBorder: UnderlineInputBorder( focusedBorder: const UnderlineInputBorder(
borderSide: BorderSide(color: AppColor.primary10, width: 2), borderSide: BorderSide(color: AppColor.primary10, width: 2),
), ),
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(

@ -18,6 +18,7 @@ class AssetPicker extends StatelessWidget {
final Asset? device; final Asset? device;
final List<Asset> deviceList; final List<Asset> deviceList;
final bool editable; final bool editable;
bool overWriteStyle;
final bool showAssetInfo; final bool showAssetInfo;
final bool showBorder; final bool showBorder;
final Color? borderColor; final Color? borderColor;
@ -34,6 +35,7 @@ class AssetPicker extends StatelessWidget {
AssetPicker( AssetPicker(
{Key? key, {Key? key,
this.editable = true, this.editable = true,
this.overWriteStyle = false,
this.device, this.device,
this.deviceList = const [], this.deviceList = const [],
this.onPick, this.onPick,
@ -46,7 +48,7 @@ class AssetPicker extends StatelessWidget {
this.labelColor, this.labelColor,
this.backgroundColor, this.backgroundColor,
this.showAssetInfo = true, this.showAssetInfo = true,
this.showBorder = false, this.showBorder = true,
this.multiSelection = false, this.multiSelection = false,
this.forPPM = false, this.forPPM = false,
this.enablePickManually = true, this.enablePickManually = true,
@ -63,22 +65,29 @@ class AssetPicker extends StatelessWidget {
return Column( return Column(
children: [ children: [
if (device == null && deviceList.isEmpty) if (device == null && deviceList.isEmpty)
// showBorder: true,
// // buttonColor: AppColor.white936,
// buttonColor: AppColor.dropDownBackground(context),
Container( Container(
height: 50.toScreenHeight, height: 50.toScreenHeight,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: buttonColor ?? backgroundColor ?? AppColor.primary10, color: overWriteStyle ? AppColor.dropDownBackground(context) : buttonColor ?? backgroundColor ?? AppColor.primary10,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
border: showBorder ? Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1) : null, border: showBorder
? Border.all(
color: overWriteStyle ? AppColor.border2Color(context) : borderColor ?? AppColor.border2Color(context),
)
: null,
// boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 14)], // boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 14)],
), ),
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
"scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.white10), "scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.icon2Color(context)),
8.width, 8.width,
' ${label ?? "Scan or Pick Asset"}'.bodyText(context).custom(color: AppColor.white10), ' ${label ?? "Scan or Pick Asset"}'.bodyText(context).custom(color: AppColor.labelTextStyleColor(context)),
], ],
), ),
).onPress(() async { ).onPress(() async {
@ -109,20 +118,22 @@ class AssetPicker extends StatelessWidget {
height: 50, height: 50,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
// // color: Colors.white, color: overWriteStyle ? AppColor.dropDownBackground(context) : buttonColor ?? backgroundColor ?? AppColor.primary10,
// borderRadius: BorderRadius.circular(10),
// border: Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1),
color: buttonColor ?? backgroundColor ?? AppColor.primary10,
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
border: showBorder ? Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1) : null, border: showBorder
? Border.all(
color: overWriteStyle ? AppColor.border2Color(context) : borderColor ?? AppColor.border2Color(context),
)
: null,
// border: showBorder ? Border.all(color: borderColor ?? AppColor.border2Color(context), width: 1) : null,
), ),
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth, vertical: 8.toScreenHeight),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
"scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.white10), "scan_asset".toSvgAsset(height: 22, fit: BoxFit.fitHeight, color: AppColor.iconColor(context)),
8.width, 8.width,
"Re-Scan or Pick Asset".bodyText(context).custom(color: AppColor.white10), "Re-Scan or Pick Asset".bodyText(context).custom(color: AppColor.labelTextStyleColor(context)),
], ],
), ),
).onPress(() async { ).onPress(() async {
@ -165,9 +176,10 @@ class AssetPicker extends StatelessWidget {
return Container( return Container(
padding: const EdgeInsets.all(12), padding: const EdgeInsets.all(12),
decoration: BoxDecoration( decoration: BoxDecoration(
//AppColor.background(context)
color: showLoading ? Colors.white : AppColor.background(context), color: showLoading ? Colors.white : AppColor.background(context),
borderRadius: BorderRadius.circular(16), borderRadius: BorderRadius.circular(16),
border: Border.all(color: borderColor ?? AppColor.borderColor(context)), border: Border.all(color: overWriteStyle ? AppColor.border2Color(context) : borderColor ?? AppColor.border2Color(context)),
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,

@ -72,8 +72,9 @@ class _SingleAssistantEmployeeMenuState extends State<AssistantEmployeeMenu> {
height: 60.toScreenHeight, height: 60.toScreenHeight,
padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth), padding: EdgeInsets.symmetric(horizontal: 16.toScreenWidth),
decoration: BoxDecoration( decoration: BoxDecoration(
color: widget.backgroundColor ?? (context.isDark ? AppColor.neutral50 : AppColor.neutral120), color: widget.backgroundColor ?? AppColor.dropDownBackground(context),
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
boxShadow: widget.hideShadow ? null : [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)], boxShadow: widget.hideShadow ? null : [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
), ),
child: Stack( child: Stack(

@ -1,21 +1,29 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:test_sa/models/new_models/assistant_employee.dart'; import 'package:test_sa/models/new_models/assistant_employee.dart';
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
import 'package:test_sa/providers/loading_list_notifier.dart';
import 'package:test_sa/views/widgets/loaders/loading_manager.dart'; import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
import 'package:test_sa/views/widgets/status/assistant_employee_menu.dart';
import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart'; import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart';
class ServiceReportAssistantEmployeeMenu extends StatelessWidget { class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
final Function(AssistantEmployees?) onSelect; final Function(AssistantEmployees?) onSelect;
final AssistantEmployees? initialValue; // Now nullable final AssistantEmployees? initialValue;
Color? backgroundColor; final Color? backgroundColor;
final String title; final String title;
final num ?assetId; final num? assetId;
final bool enable; final bool enable;
ServiceReportAssistantEmployeeMenu({Key? key, required this.onSelect, required this.title, required this.initialValue, this.assetId, this.backgroundColor, this.enable = true}) const ServiceReportAssistantEmployeeMenu({
: super(key: key); Key? key,
required this.onSelect,
required this.title,
required this.initialValue,
this.assetId,
this.backgroundColor,
this.enable = true,
}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -25,88 +33,23 @@ class ServiceReportAssistantEmployeeMenu extends StatelessWidget {
isFailedLoading: menuProvider.assistantEmployees == null, isFailedLoading: menuProvider.assistantEmployees == null,
stateCode: menuProvider.stateCode, stateCode: menuProvider.stateCode,
onRefresh: () async { onRefresh: () async {
await menuProvider.getAssistantEmployees(assetId:assetId); await menuProvider.getAssistantEmployees(assetId: assetId);
}, },
child: AssistantEmployeeMenu( child: SingleItemDropDownMenu<AssistantEmployees, NullableLoadingProvider>(
initialStatus: initialValue, context: context,
title: title, title: title,
staticData: menuProvider.assistantEmployees ?? [],
showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
hideShadow: true, loading: menuProvider.isLoading,
statuses: menuProvider.assistantEmployees ?? [], initialValue: initialValue,
backgroundColor: backgroundColor, enabled: enable,
// Provide an empty list if null onSelect: (employee) async {
onSelect: onSelect, if (employee != null) {
// Pass onSelect directly onSelect(employee);
enable: enable, }
},
), ),
); );
} }
} }
// import 'package:flutter/material.dart';
// import 'package:provider/provider.dart';
// import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
// import 'package:test_sa/providers/loading_list_notifier.dart';
// import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
//
// import '../../../../controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart';
// import '../../../../models/new_models/assistant_employee.dart';
//
// class ServiceReportAssistantEmployeeMenu extends StatefulWidget {
// final Function(AssistantEmployees) onSelect;
// final AssistantEmployees initialValue;
// final String title;
// final num assetId;
// final bool enabled;
//
// const ServiceReportAssistantEmployeeMenu({Key? key, this.enabled = true, required this.onSelect, required this.assetId, this.title, this.initialValue}) : super(key: key);
//
// @override
// State<ServiceReportAssistantEmployeeMenu> createState() => _ServiceReportAssistantEmployeeMenuState();
// }
//
// class _ServiceReportAssistantEmployeeMenuState extends State<ServiceReportAssistantEmployeeMenu> {
// AssistantEmployees _initialValue;
//
// @override
// void initState() {
// _initialValue = widget.initialValue;
// super.initState();
// }
//
// @override
// void didUpdateWidget(covariant ServiceReportAssistantEmployeeMenu oldWidget) {
// if (widget.initialValue != oldWidget.initialValue) {
// _initialValue = widget.initialValue;
// setState(() {});
// }
// super.didUpdateWidget(oldWidget);
// }
//
// @override
// Widget build(BuildContext context) {
// ServiceReportAssistantsEmployeeProvider menuProvider = Provider.of<ServiceReportAssistantsEmployeeProvider>(context);
// return LoadingManager(
// isLoading: menuProvider.isLoading,
// isFailedLoading: menuProvider.assistantEmployees == null,
// stateCode: menuProvider.stateCode,
// onRefresh: () async {
// await menuProvider.getAssistantEmployees(widget.assetId);
// },
// child: SingleItemDropDownMenu<AssistantEmployees, NullableLoadingProvider>(
// title: widget.title,
// context: context,
// enabled: widget.enabled,
// initialValue: _initialValue,
// staticData: menuProvider.assistantEmployees,
// onSelect: widget.onSelect,
// ),
// // child: AssistantEmployeeMenu(
// // title: title,
// // initialStatus: initialValue,
// // statuses: menuProvider.assistantEmployees,
// // onSelect: onSelect,
// // ),
// );
// }
// }

@ -166,7 +166,7 @@ class _AppTimerState extends State<AppTimer> {
ADatePicker( ADatePicker(
label: context.translation.startTime, label: context.translation.startTime,
hideShadow: true, hideShadow: true,
backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral90, backgroundColor: AppColor.dropDownBackground(context),
date: _pickerStartAt, date: _pickerStartAt,
from: widget.pickerFromDate, from: widget.pickerFromDate,
enable: widget.enabled ? _tempPickerTimer == null : false, enable: widget.enabled ? _tempPickerTimer == null : false,

Loading…
Cancel
Save