Compare commits

...

6 Commits

@ -1,7 +1,7 @@
class URLs { class URLs {
URLs._(); URLs._();
static const String appReleaseBuildNumber = "24"; static const String appReleaseBuildNumber = "28";
static const host1 = "https://atomsm.hmg.com"; // production url static const host1 = "https://atomsm.hmg.com"; // production url
// static const host1 = "https://atomsmdev.hmg.com"; // local DEV url // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url
@ -10,7 +10,7 @@ class URLs {
// static String _baseUrl = "$_host/mobile"; // static String _baseUrl = "$_host/mobile";
// static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis
// static final String _baseUrl = "$_host/mobile"; // host local UAT // static final String _baseUrl = "$_host/mobile"; // host local UAT
static final String _baseUrl = "$_host/v3/mobile"; // v3 for production CM,PM,TM static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM
static String _host = host1; static String _host = host1;

@ -151,7 +151,7 @@ class WorkOrderData {
Lookup? serviceType; Lookup? serviceType;
Lookup? failureReasone; Lookup? failureReasone;
FaultDescription? faultDescription; FaultDescription? faultDescription;
Lookup? solution; String? solution;
String? edd; String? edd;
Lookup? cmFrame; Lookup? cmFrame;
@ -237,7 +237,7 @@ class WorkOrderData {
serviceType: json["serviceType"] == null ? null : Lookup.fromJson(json["serviceType"]), serviceType: json["serviceType"] == null ? null : Lookup.fromJson(json["serviceType"]),
failureReasone: json["failureReasone"] == null ? null : Lookup.fromJson(json["failureReasone"]), failureReasone: json["failureReasone"] == null ? null : Lookup.fromJson(json["failureReasone"]),
faultDescription: json["faultDescription"] == null ? null : FaultDescription.fromJson(json["faultDescription"]), faultDescription: json["faultDescription"] == null ? null : FaultDescription.fromJson(json["faultDescription"]),
solution: json["solution"] == null ? null : Lookup.fromJson(json["solution"]), solution: json["solution"],
totalWorkingHours: (json["totalWorkingHours"] ?? "").toString(), totalWorkingHours: (json["totalWorkingHours"] ?? "").toString(),
workOrderHistory: json["workOrderHistory"] == null ? [] : List<WorkOrderHistory>.from(json["workOrderHistory"]!.map((x) => WorkOrderHistory.fromJson(x))), workOrderHistory: json["workOrderHistory"] == null ? [] : List<WorkOrderHistory>.from(json["workOrderHistory"]!.map((x) => WorkOrderHistory.fromJson(x))),
activities: json["activities"] == null ? [] : List<Activities>.from(json["activities"]!.map((x) => Activities.fromJson(x))), activities: json["activities"] == null ? [] : List<Activities>.from(json["activities"]!.map((x) => Activities.fromJson(x))),
@ -290,7 +290,7 @@ class WorkOrderData {
"returnToService": returnToService, "returnToService": returnToService,
"serviceType": serviceType?.toJson(), "serviceType": serviceType?.toJson(),
"failureReasone": failureReasone?.toJson(), "failureReasone": failureReasone?.toJson(),
"solution": solution?.toJson(), "solution": solution,
"totalWorkingHours": totalWorkingHours, "totalWorkingHours": totalWorkingHours,
"workOrderHistory": workOrderHistory.map((x) => x.toJson()).toList(), "workOrderHistory": workOrderHistory.map((x) => x.toJson()).toList(),
"activities": activities.map((x) => x.toJson()).toList(), "activities": activities.map((x) => x.toJson()).toList(),

@ -252,6 +252,7 @@ class ServiceRequestDetailProvider extends ChangeNotifier {
} catch (e) { } catch (e) {
log("getWorkOrder [error] : $e"); log("getWorkOrder [error] : $e");
isLoading = false; isLoading = false;
currentWorkOrder = null;
notifyListeners(); notifyListeners();
return null; return null;
} }

@ -137,24 +137,29 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
children: [ children: [
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Wrap(
// spacing: 8,
runSpacing: 8,
children: [ children: [
if (Provider.of<SettingProvider>(context, listen: false).showPriority) ...[ if (Provider.of<SettingProvider>(context, listen: false).showPriority) ...[
StatusLabel( StatusLabel(
label: workOrder.priority?.name, label: workOrder.priority?.name,
id: workOrder.priority!.id!, id: workOrder.priority!.value!,
radius: 4, radius: 4,
textColor: AppColor.getPriorityStatusTextColor(context, workOrder.priority!.id!), textColor: AppColor.getPriorityStatusTextColor(context, workOrder.priority!.value!),
backgroundColor: AppColor.getPriorityStatusColor(context, workOrder.priority!.id!), backgroundColor: AppColor.getPriorityStatusColor(context, workOrder.priority!.value!),
), ),
8.width, 8.width,
], ],
if (workOrder.itgFormWorkOrderStatus != null) ...[ if (workOrder.itgFormWorkOrderStatus != null) ...[
StatusLabel( StatusLabel(
label: workOrder.itgFormWorkOrderStatus, label: workOrder.itgFormWorkOrderStatus,
id: 0, // id: 0,
radius: 4, radius: 4,
textColor: AppColor.getPriorityStatusTextColor(context, 82), textColor: AppColor.getPriorityStatusTextColor(context, 82),
backgroundColor: AppColor.getPriorityStatusColor(context, 0), backgroundColor: AppColor.getPriorityStatusColor(context, 1000),
), ),
8.width, 8.width,
], ],
@ -173,7 +178,8 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
backgroundColor: AppColor.orange30, backgroundColor: AppColor.orange30,
), ),
], ],
1.width.expanded, ],
).expanded,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
@ -181,7 +187,7 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
// context.translation.code.toSvgAsset(width: 48).onPress(() { // context.translation.code.toSvgAsset(width: 48).onPress(() {
// // Navigator.push(context, MaterialPageRoute(builder: (context) => UpdateServiceRequestPage(serviceRequest: serviceRequest))); // // Navigator.push(context, MaterialPageRoute(builder: (context) => UpdateServiceRequestPage(serviceRequest: serviceRequest)));
// }), // }),
if (userProvider.user!.type == UsersTypes.engineer) 16.height, // if (userProvider.user!.type == UsersTypes.engineer) 16.height,
Text( Text(
workOrder.requestedDate!.toString().toServiceRequestCardFormat, workOrder.requestedDate!.toString().toServiceRequestCardFormat,
textAlign: TextAlign.end, textAlign: TextAlign.end,
@ -191,6 +197,7 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
) )
], ],
), ),
8.height,
Text( Text(
context.translation.assetInformation, context.translation.assetInformation,
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
@ -507,9 +514,7 @@ class _ServiceRequestDetailViewState extends State<ServiceRequestDetailView> {
style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
).expanded, ).expanded,
if (!provider.isReadOnlyRequest) if (!provider.isReadOnlyRequest)
"edit_icon".toSvgAsset(height: 21, width: 21, "edit_icon".toSvgAsset(height: 21, width: 21, color: context.isDark ? AppColor.primary10 : null).onPress(() async {
color: context.isDark?AppColor.primary10:null
).onPress(() async {
provider.refreshTimer = false; provider.refreshTimer = false;
await Navigator.push(context, MaterialPageRoute(builder: (context) => CostDetailFormScreen(isEdit: true))); await Navigator.push(context, MaterialPageRoute(builder: (context) => CostDetailFormScreen(isEdit: true)));
provider.refreshTimer = true; provider.refreshTimer = true;

@ -253,6 +253,7 @@ class _VerifyAssetDetailsState extends State<VerifyAssetDetails> with TickerProv
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
// initialDate: DateTime.tryParse(updateAssetModel?.edd ?? ""), // initialDate: DateTime.tryParse(updateAssetModel?.edd ?? ""),
from: requestDetailProvider.currentWorkOrder?.data?.requestedDate, from: requestDetailProvider.currentWorkOrder?.data?.requestedDate,
to: DateTime.now().add(const Duration(days: 365)),
date: DateTime.tryParse(updateAssetModel?.edd ?? ""), date: DateTime.tryParse(updateAssetModel?.edd ?? ""),
formatDateWithTime: true, formatDateWithTime: true,
onDatePicker: (selectedDate) { onDatePicker: (selectedDate) {

@ -117,13 +117,13 @@ class _PpmDetailsPageState extends State<PpmDetailsPage> {
).paddingAll(16) ).paddingAll(16)
] ]
else ...[ else ...[
AppFilledButton( // AppFilledButton(
onPressed: () async { // onPressed: () async {
await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdatePpm(ppm: null, planPreventiveVisit: planPreventiveVisit))); // await Navigator.of(context).push(MaterialPageRoute(builder: (_) => UpdatePpm(ppm: null, planPreventiveVisit: planPreventiveVisit)));
getVisitData(); // getVisitData();
}, // },
label: context.translation.viewDetails, // label: context.translation.viewDetails,
).paddingAll(16) // ).paddingAll(16)
] ]
]):const Center(child: NoDataFound()); ]):const Center(child: NoDataFound());
}), }),

@ -58,7 +58,7 @@ class _PpmExternalDetailsFormState extends State<PpmExternalDetailsForm> {
final ppmProvider = Provider.of<PpmProvider>(context, listen: false); final ppmProvider = Provider.of<PpmProvider>(context, listen: false);
return ListView.builder( return ListView.builder(
itemCount: widget.models!.length + 1, itemCount: widget.models!.length + 1,
padding: const EdgeInsets.all(16), padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 16),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (index == widget.models!.length) { if (index == widget.models!.length) {
return Visibility( return Visibility(
@ -190,7 +190,7 @@ class _ExternalDetailItemState extends State<ExternalDetailItem> {
), ),
child: Icon(Icons.add, color: context.isDark ? null : AppColor.neutral60), child: Icon(Icons.add, color: context.isDark ? null : AppColor.neutral60),
).onPress(() async { ).onPress(() async {
if(widget.model.supplier==null) { if (widget.model.supplier == null) {
"Please select supplier".showToast; "Please select supplier".showToast;
return; return;
} }

@ -104,7 +104,7 @@ class _UpdatePpmState extends State<UpdatePpm> with TickerProviderStateMixin {
if (typeOfService == null) { if (typeOfService == null) {
return; return;
} }
if (typeOfService?.id == 66) { if (typeOfService?.value == 2) {
ppmProvider.totalTabs = 4; ppmProvider.totalTabs = 4;
} else { } else {
ppmProvider.totalTabs = 3; ppmProvider.totalTabs = 3;

@ -268,7 +268,7 @@ class _WoInfoFormState extends State<WoInfoForm> {
onSelect: (value) { onSelect: (value) {
if (value != null) { if (value != null) {
widget.planPreventiveVisit.typeOfService = value; widget.planPreventiveVisit.typeOfService = value;
if (widget.planPreventiveVisit.typeOfService?.id == 66) { if (widget.planPreventiveVisit.typeOfService?.value == 2) {
ppmProvider.totalTabs = 4; ppmProvider.totalTabs = 4;
} else { } else {
ppmProvider.totalTabs = 3; ppmProvider.totalTabs = 3;

@ -258,6 +258,11 @@ static Color getActivityTypeTextColor(String type) {
return green15; return green15;
case 370: case 370:
return green15; return green15;
case 0:
return green15;
case 1:
//high priority
return white10;
case 82: case 82:
//high priority //high priority
return white10; return white10;
@ -273,9 +278,13 @@ static Color getActivityTypeTextColor(String type) {
return greenStatus(context); return greenStatus(context);
case 370: case 370:
return greenStatus(context); return greenStatus(context);
case 0:
return greenStatus(context);
//high priority //high priority
case 82: case 82:
return redStatus(context); return redStatus(context);
case 1:
return redStatus(context);
default: default:
return blueStatus(context); return blueStatus(context);
} }

@ -16,6 +16,7 @@ class SingleItemDropDownMenu<T extends Base, X extends LoadingListNotifier> exte
final BuildContext context; final BuildContext context;
final Function(T?)? onSelect; // Now accepts nullable values final Function(T?)? onSelect; // Now accepts nullable values
final T? initialValue; final T? initialValue;
final T? disableValue;
final bool enabled; final bool enabled;
final bool showAsBottomSheet; final bool showAsBottomSheet;
final bool showAsFullScreenDialog; final bool showAsFullScreenDialog;
@ -35,6 +36,7 @@ class SingleItemDropDownMenu<T extends Base, X extends LoadingListNotifier> exte
required this.context, required this.context,
this.onSelect, this.onSelect,
this.initialValue, this.initialValue,
this.disableValue,
this.enabled = true, this.enabled = true,
this.height, this.height,
this.showAsBottomSheet = false, this.showAsBottomSheet = false,
@ -160,11 +162,13 @@ class _SingleItemDropDownMenuState<T extends Base, X extends LoadingListNotifier
value: value, value: value,
child: Text( child: Text(
value.name ?? "", // Null-aware operator for value.name value.name ?? "", // Null-aware operator for value.name
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500, color: context.isDark?AppColor.white10: AppColor.black10), maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w500, color: context.isDark ? AppColor.white10 : AppColor.black10),
), ),
); );
}).toList(), }).toList(),
).onPress(widget.showAsFullScreenDialog ).onPress(widget.enabled && widget.showAsFullScreenDialog
? () { ? () {
openDialog(); openDialog();
} }
@ -220,6 +224,7 @@ class _SingleItemDropDownMenuState<T extends Base, X extends LoadingListNotifier
items: ((X == NullableLoadingProvider) ? widget.staticData : provider?.items as List<T>) ?? [], items: ((X == NullableLoadingProvider) ? widget.staticData : provider?.items as List<T>) ?? [],
// Provide default empty list if null // Provide default empty list if null
selectedItem: _selectedItem, selectedItem: _selectedItem,
disableItem: widget.disableValue,
title: widget.title, title: widget.title,
showCancel: widget.showCancel, showCancel: widget.showCancel,
onSelect: (selectedT) { onSelect: (selectedT) {

@ -80,7 +80,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
_formKey.currentState!.save(); _formKey.currentState!.save();
List<AssetTransferAttachment> attachement = []; List<AssetTransferAttachment> attachement = [];
for (var item in attachments) { for (var item in attachments) {
String fileName = ServiceRequestUtils.isLocalUrl(item.name??'') ? ("${item.name??''.split("/").last}|${base64Encode(File(item.name??'').readAsBytesSync())}") :item.name??''; String fileName = ServiceRequestUtils.isLocalUrl(item.name ?? '') ? ("${item.name ?? ''.split("/").last}|${base64Encode(File(item.name ?? '').readAsBytesSync())}") : item.name ?? '';
attachement.add(AssetTransferAttachment(id: item.id, attachmentName: fileName)); attachement.add(AssetTransferAttachment(id: item.id, attachmentName: fileName));
} }
_transferModel.attachments = attachement; _transferModel.attachments = attachement;
@ -135,19 +135,26 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
backgroundColor: AppColor.white936, backgroundColor: AppColor.white936,
onPick: (asset) async { onPick: (asset) async {
_pickedAsset = asset; _pickedAsset = asset;
if (_pickedAsset?.site != null && _transferModel.transferType?.value == 1) { if (_pickedAsset?.site != null && _transferModel.transferType?.value == 1) {
await _deviceTransferProvider.getSiteData(siteId: int.tryParse(_pickedAsset!.site!.id.toString())); await _deviceTransferProvider.getSiteData(siteId: int.tryParse(_pickedAsset!.site!.id.toString()));
_assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site; _assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site;
_assetDestination.building = null; _assetDestination.building = null;
_assetDestination.floor = null; _assetDestination.floor = null;
_assetDestination.department = null; _assetDestination.department = null;
} else if (_pickedAsset?.site != null && _transferModel.transferType?.value == 2) {
_assetDestination.site = null;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
} }
setState(() {}); setState(() {});
}), }),
21.height, 21.height,
requestTypeWidget(context), requestTypeWidget(context),
12.height, 12.height,
"Destination".bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936), "Destination".bodyText(context).custom(color: context.isDark ? Colors.white : AppColor.white936),
12.height, 12.height,
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -156,6 +163,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
context: context, context: context,
title: context.translation.site, title: context.translation.site,
initialValue: _assetDestination.site, initialValue: _assetDestination.site,
disableValue: isInternal ? null : _pickedAsset?.site,
showShadow: false, showShadow: false,
loading: _deviceTransferProvider.isSiteLoading, loading: _deviceTransferProvider.isSiteLoading,
enabled: !isInternal, enabled: !isInternal,
@ -273,7 +281,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
context.translation.requestType.bodyText(context).custom(color:context.isDark?Colors.white: AppColor.white936), context.translation.requestType.bodyText(context).custom(color: context.isDark ? Colors.white : AppColor.white936),
8.height, 8.height,
Wrap( Wrap(
runSpacing: 8, runSpacing: 8,
@ -299,7 +307,17 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
onChanged: (state) { onChanged: (state) {
_transferModel.transferType = element; _transferModel.transferType = element;
isInternal = !isInternal; isInternal = !isInternal;
// _assetDestination = Asset(); if (isInternal) {
_assetDestination.site = _deviceTransferProvider.internalAssetDestination?.site;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
} else {
_assetDestination.site = null;
_assetDestination.building = null;
_assetDestination.floor = null;
_assetDestination.department = null;
}
setState(() {}); setState(() {});
// }); // });
@ -310,7 +328,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
], ],
) )
], ],
).toShimmer(isShow: snapshot.loading,context: context), ).toShimmer(isShow: snapshot.loading, context: context),
], ],
); );
}); });

@ -3,26 +3,29 @@ import 'package:test_sa/extensions/context_extension.dart';
import 'package:test_sa/extensions/int_extensions.dart'; import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart'; 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/models/base.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';
typedef SelectionBuilderString = String Function(dynamic); typedef SelectionBuilderString = String Function(dynamic);
class SelectionFullScreenDialog<T> extends StatefulWidget { class SelectionFullScreenDialog<T extends Base> extends StatefulWidget {
final List<T>? items; final List<T>? items;
final T? selectedItem; // Now nullable final T? selectedItem; // Now nullable
final T? disableItem; // Now nullable
final String title; final String title;
final bool showCancel; final bool showCancel;
final SelectionBuilderString builderString; final SelectionBuilderString builderString;
final Function(T?) onSelect; final Function(T?) onSelect;
const SelectionFullScreenDialog({Key? key, this.items, this.selectedItem, this.title = "", required this.builderString, this.showCancel = false, required this.onSelect}) : super(key: key); const SelectionFullScreenDialog({Key? key, this.items, this.selectedItem, this.disableItem, this.title = "", required this.builderString, this.showCancel = false, required this.onSelect})
: super(key: key);
@override @override
_SelectionBottomSheetState createState() => _SelectionBottomSheetState<T>(); _SelectionBottomSheetState createState() => _SelectionBottomSheetState<T>();
} }
class _SelectionBottomSheetState<T> extends State<SelectionFullScreenDialog<T>> { class _SelectionBottomSheetState<T extends Base> extends State<SelectionFullScreenDialog<T>> {
T? _selectedValue; // Now nullable T? _selectedValue; // Now nullable
String query = ""; String query = "";
@ -126,7 +129,9 @@ class _SelectionBottomSheetState<T> extends State<SelectionFullScreenDialog<T>>
child: ListView.builder( child: ListView.builder(
itemCount: filteredList?.length, itemCount: filteredList?.length,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (cxt, index) =>Theme( itemBuilder: (cxt, index) {
bool isDisabledItem = widget.disableItem != null && widget.disableItem?.identifier == filteredList![index].identifier;
return Theme(
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
radioTheme: RadioThemeData( radioTheme: RadioThemeData(
fillColor: MaterialStateColor.resolveWith((states) { fillColor: MaterialStateColor.resolveWith((states) {
@ -145,18 +150,20 @@ class _SelectionBottomSheetState<T> extends State<SelectionFullScreenDialog<T>>
groupValue: _selectedValue, groupValue: _selectedValue,
activeColor: AppColor.iconColor(context), activeColor: AppColor.iconColor(context),
hoverColor: Colors.transparent, hoverColor: Colors.transparent,
onChanged: (value) { onChanged: isDisabledItem
? null
: (value) {
_selectedValue = value; _selectedValue = value;
searchFocusNode.unfocus(); searchFocusNode.unfocus();
setState(() {}); setState(() {});
}, },
title: Text( title: Text(
widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "", widget.builderString(filteredList![index]).cleanupWhitespace.capitalizeFirstOfEach ?? "",
style: Theme.of(context).textTheme.bodyLarge, style: Theme.of(context).textTheme.bodyLarge?.copyWith(color: isDisabledItem ? AppColor.neutral20:null),
),
),
), ),
), ),
);
}),
), ),
8.height, 8.height,
if (_selectedValue != null) if (_selectedValue != null)

@ -11,23 +11,23 @@ class StatusLabel extends StatelessWidget {
final double radius; final double radius;
final bool labelInCenter; final bool labelInCenter;
StatusLabel({Key? key, this.id = 0, this.label, this.backgroundColor, this.textColor, this.isPriority = false, this.radius = 4,this.labelInCenter=false}) : super(key: key); StatusLabel({Key? key, this.id = 0, this.label, this.backgroundColor, this.textColor, this.isPriority = false, this.radius = 4, this.labelInCenter = false}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (id == 82) label = context.translation.highPriority;
if (id == 81) label = context.translation.lowPriority;
if (label?.toLowerCase() == 'In progress'.toLowerCase()) label = context.translation.inProgress; if (label?.toLowerCase() == 'In progress'.toLowerCase()) label = context.translation.inProgress;
if (label?.toLowerCase() == 'Completed'.toLowerCase()) label = context.translation.completed; if (label?.toLowerCase() == 'Completed'.toLowerCase()) label = context.translation.completed;
if (label?.toLowerCase() == 'Open'.toLowerCase()) label = context.translation.open; if (label?.toLowerCase() == 'Open'.toLowerCase()) label = context.translation.open;
if (label?.toLowerCase() == 'Closed'.toLowerCase()) label = context.translation.closed; if (label?.toLowerCase() == 'Closed'.toLowerCase()) label = context.translation.closed;
if (label?.toLowerCase() == 'Low'.toLowerCase()) label = context.translation.lowPriority; if (label?.toLowerCase() == 'Low'.toLowerCase()) label = context.translation.lowPriority;
if (label?.toLowerCase() == 'No'.toLowerCase()) label = context.translation.lowPriority;
if (label?.toLowerCase() == 'High'.toLowerCase()) label = context.translation.highPriority; if (label?.toLowerCase() == 'High'.toLowerCase()) label = context.translation.highPriority;
if (label?.toLowerCase() == 'Yes'.toLowerCase()) label = context.translation.highPriority;
if (label?.toLowerCase() == 'Waiting for quotation'.toLowerCase()) label = context.translation.waitingForQuotation; if (label?.toLowerCase() == 'Waiting for quotation'.toLowerCase()) label = context.translation.waitingForQuotation;
return Container( return Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10), padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
alignment: labelInCenter ? Alignment.center: null, alignment: labelInCenter ? Alignment.center : null,
decoration: ShapeDecoration( decoration: ShapeDecoration(
color: backgroundColor, color: backgroundColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.3.8+27 version: 1.3.11+30
environment: environment:
sdk: ">=3.5.0 <4.0.0" sdk: ">=3.5.0 <4.0.0"

Loading…
Cancel
Save