Merge remote-tracking branch 'origin/main_design2.0' into main_design2.0
commit
d6de203ba0
@ -0,0 +1,3 @@
|
||||
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.9499 9.51862C12.6027 8.54479 12.984 7.37301 12.984 6.11339C12.984 2.74246 10.2534 0 6.89703 0C3.54065 0 0.810059 2.74246 0.810059 6.11336C0.810059 9.48425 3.54068 12.2267 6.89706 12.2267C8.176 12.2267 9.36378 11.8282 10.3445 11.1488L15.1958 16L16.8101 14.3788L11.9499 9.51862ZM6.89706 10.5097C4.48871 10.5097 2.52931 8.54181 2.52931 6.12299C2.52931 3.70421 4.48868 1.73634 6.89706 1.73634C9.30543 1.73634 11.2648 3.70421 11.2648 6.12302C11.2648 8.54184 9.3054 10.5097 6.89706 10.5097Z" fill="#767676"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 619 B |
@ -0,0 +1,707 @@
|
||||
import 'package:test_sa/models/device/technical_guidance_book.dart';
|
||||
import 'package:test_sa/models/lookup.dart';
|
||||
|
||||
class AssetByIdModel {
|
||||
List<MultiAssets> multiAssets;
|
||||
int id;
|
||||
ModelDefinition modelDefinition;
|
||||
Suppliers supplier;
|
||||
String ipAddress;
|
||||
String macAddress;
|
||||
String portNumber;
|
||||
AssetReplace assetReplace;
|
||||
AssetInfo oldAsset;
|
||||
AssetReplace isParent;
|
||||
AssetInfo parentAsset;
|
||||
AssetReplace assetType;
|
||||
String demoRequest;
|
||||
String missionCritical;
|
||||
Site site;
|
||||
AssetReplace building;
|
||||
AssetReplace floor;
|
||||
Department department;
|
||||
String room;
|
||||
int testsDay;
|
||||
num purchasingPrice;
|
||||
String nbv;
|
||||
String currency;
|
||||
String poDate;
|
||||
String poNo;
|
||||
String invoiceNumber;
|
||||
String invoiceDate;
|
||||
String replacementDate;
|
||||
num budgetYear;
|
||||
num lastPOPrice;
|
||||
Lookup commissioningStatus;
|
||||
Department originDepartment;
|
||||
Site originSite;
|
||||
String productionDate;
|
||||
String edd;
|
||||
String technicalInspectionDate;
|
||||
String deliveryInspectionDate;
|
||||
String endUserAcceptanceDate;
|
||||
String technicalAcceptanceDate;
|
||||
String finalAcceptanceDate;
|
||||
String installationDate;
|
||||
int siteWarrantyMonthNo;
|
||||
num extendedWarrantyMonthNo;
|
||||
num remainderWarrantyMonthNo;
|
||||
num eomWarrantyMonthsNo;
|
||||
num warrantyValue;
|
||||
String warrantyEndDate;
|
||||
String warrantyContractConditions;
|
||||
List<TechnicalGuidanceBook> technicalGuidanceBooks;
|
||||
String comment;
|
||||
bool isEnabled;
|
||||
String tagCode;
|
||||
List<String> assetAttachments;
|
||||
String retirementTypeName;
|
||||
String retirementStatusName;
|
||||
String retirementDate;
|
||||
AssetGroup assetGroup;
|
||||
String assetPhoto;
|
||||
String nextPMDate;
|
||||
String lastPMDate;
|
||||
|
||||
AssetByIdModel(
|
||||
{this.multiAssets,
|
||||
this.id,
|
||||
this.modelDefinition,
|
||||
this.supplier,
|
||||
this.ipAddress,
|
||||
this.macAddress,
|
||||
this.portNumber,
|
||||
this.assetReplace,
|
||||
this.oldAsset,
|
||||
this.isParent,
|
||||
this.parentAsset,
|
||||
this.assetType,
|
||||
this.demoRequest,
|
||||
this.missionCritical,
|
||||
this.site,
|
||||
this.building,
|
||||
this.floor,
|
||||
this.department,
|
||||
this.room,
|
||||
this.testsDay,
|
||||
this.purchasingPrice,
|
||||
this.nbv,
|
||||
this.currency,
|
||||
this.poDate,
|
||||
this.poNo,
|
||||
this.invoiceNumber,
|
||||
this.invoiceDate,
|
||||
this.replacementDate,
|
||||
this.budgetYear,
|
||||
this.lastPOPrice,
|
||||
this.commissioningStatus,
|
||||
this.originDepartment,
|
||||
this.originSite,
|
||||
this.productionDate,
|
||||
this.edd,
|
||||
this.technicalInspectionDate,
|
||||
this.deliveryInspectionDate,
|
||||
this.endUserAcceptanceDate,
|
||||
this.technicalAcceptanceDate,
|
||||
this.finalAcceptanceDate,
|
||||
this.installationDate,
|
||||
this.siteWarrantyMonthNo,
|
||||
this.extendedWarrantyMonthNo,
|
||||
this.remainderWarrantyMonthNo,
|
||||
this.eomWarrantyMonthsNo,
|
||||
this.warrantyValue,
|
||||
this.warrantyEndDate,
|
||||
this.warrantyContractConditions,
|
||||
this.technicalGuidanceBooks,
|
||||
this.comment,
|
||||
this.isEnabled,
|
||||
this.tagCode,
|
||||
this.assetAttachments,
|
||||
this.retirementTypeName,
|
||||
this.retirementStatusName,
|
||||
this.retirementDate,
|
||||
this.assetGroup,
|
||||
this.assetPhoto,
|
||||
this.nextPMDate,
|
||||
this.lastPMDate});
|
||||
|
||||
AssetByIdModel.fromJson(Map<String, dynamic> json) {
|
||||
if (json['multiAssets'] != null) {
|
||||
multiAssets = <MultiAssets>[];
|
||||
json['multiAssets'].forEach((v) {
|
||||
multiAssets.add(new MultiAssets.fromJson(v));
|
||||
});
|
||||
}
|
||||
id = json['id'];
|
||||
print("supplier:${json['supplier']}");
|
||||
modelDefinition = json['modelDefinition'] != null ? new ModelDefinition.fromJson(json['modelDefinition']) : null;
|
||||
supplier = json['supplier'] != null ? Suppliers.fromJson(json['supplier']) : null;
|
||||
ipAddress = json['ipAddress'];
|
||||
macAddress = json['macAddress'];
|
||||
portNumber = json['portNumber'];
|
||||
assetReplace = json['assetReplace'] != null ? new AssetReplace.fromJson(json['assetReplace']) : null;
|
||||
oldAsset = json['oldAsset'] != null ? AssetInfo.fromJson(json['oldAsset']) : null;
|
||||
isParent = json['isParent'] != null ? new AssetReplace.fromJson(json['isParent']) : null;
|
||||
parentAsset = json['parentAsset'] != null ? AssetInfo.fromJson(json['parentAsset']) : null;
|
||||
assetType = json['assetType'] != null ? new AssetReplace.fromJson(json['assetType']) : null;
|
||||
demoRequest = json['demoRequest'];
|
||||
missionCritical = json['missionCritical'];
|
||||
site = json['site'] != null ? new Site.fromJson(json['site']) : null;
|
||||
building = json['building'] != null ? new AssetReplace.fromJson(json['building']) : null;
|
||||
floor = json['floor'] != null ? new AssetReplace.fromJson(json['floor']) : null;
|
||||
department = json['department'] != null ? new Department.fromJson(json['department']) : null;
|
||||
room = json['room'];
|
||||
testsDay = json['testsDay'];
|
||||
purchasingPrice = json['purchasingPrice'];
|
||||
nbv = json['nbv'];
|
||||
currency = json['currency'];
|
||||
poDate = json['poDate'];
|
||||
poNo = json['poNo'];
|
||||
invoiceNumber = json['invoiceNumber'];
|
||||
invoiceDate = json['invoiceDate'];
|
||||
replacementDate = json['replacementDate'];
|
||||
budgetYear = json['budgetYear'];
|
||||
lastPOPrice = json['lastPOPrice'];
|
||||
commissioningStatus = json['commissioningStatus'] != null ? new Lookup.fromJson(json['commissioningStatus']) : null;
|
||||
originDepartment = json['originDepartment'] != null ? new Department.fromJson(json['originDepartment']) : null;
|
||||
originSite = json['originSite'] != null ? new Site.fromJson(json['originSite']) : null;
|
||||
productionDate = json['productionDate'];
|
||||
edd = json['edd'];
|
||||
technicalInspectionDate = json['technicalInspectionDate'];
|
||||
deliveryInspectionDate = json['deliveryInspectionDate'];
|
||||
endUserAcceptanceDate = json['endUserAcceptanceDate'];
|
||||
technicalAcceptanceDate = json['technicalAcceptanceDate'];
|
||||
finalAcceptanceDate = json['finalAcceptanceDate'];
|
||||
installationDate = json['installationDate'];
|
||||
siteWarrantyMonthNo = json['siteWarrantyMonthNo'];
|
||||
extendedWarrantyMonthNo = json['extendedWarrantyMonthNo'];
|
||||
remainderWarrantyMonthNo = json['remainderWarrantyMonthNo'];
|
||||
eomWarrantyMonthsNo = json['eomWarrantyMonthsNo'];
|
||||
warrantyValue = json['warrantyValue'];
|
||||
warrantyEndDate = json['warrantyEndDate'];
|
||||
warrantyContractConditions = json['warrantyContractConditions'];
|
||||
if (json['technicalGuidanceBooks'] != null) {
|
||||
technicalGuidanceBooks = [];
|
||||
json['technicalGuidanceBooks'].forEach((v) {
|
||||
technicalGuidanceBooks.add(TechnicalGuidanceBook.fromJson(v));
|
||||
});
|
||||
}
|
||||
comment = json['comment'];
|
||||
isEnabled = json['isEnabled'];
|
||||
tagCode = json['tagCode'];
|
||||
if (json['assetAttachments'] != null) {
|
||||
assetAttachments = <Null>[];
|
||||
json['assetAttachments'].forEach((v) {
|
||||
assetAttachments.add(v);
|
||||
});
|
||||
}
|
||||
retirementTypeName = json['retirementTypeName'];
|
||||
retirementStatusName = json['retirementStatusName'];
|
||||
retirementDate = json['retirementDate'];
|
||||
assetGroup = json['assetGroup'] != null ? new AssetGroup.fromJson(json['assetGroup']) : null;
|
||||
assetPhoto = json['assetPhoto'];
|
||||
nextPMDate = json['nextPMDate'];
|
||||
lastPMDate = json['lastPMDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.multiAssets != null) {
|
||||
data['multiAssets'] = this.multiAssets.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['id'] = this.id;
|
||||
if (this.modelDefinition != null) {
|
||||
data['modelDefinition'] = this.modelDefinition.toJson();
|
||||
}
|
||||
if (this.supplier != null) {
|
||||
data['supplier'] = this.supplier.toJson();
|
||||
}
|
||||
data['ipAddress'] = this.ipAddress;
|
||||
data['macAddress'] = this.macAddress;
|
||||
data['portNumber'] = this.portNumber;
|
||||
if (this.assetReplace != null) {
|
||||
data['assetReplace'] = this.assetReplace.toJson();
|
||||
}
|
||||
data['oldAsset'] = this.oldAsset?.toJson();
|
||||
if (this.isParent != null) {
|
||||
data['isParent'] = this.isParent.toJson();
|
||||
}
|
||||
data['parentAsset'] = this.parentAsset?.toJson();
|
||||
if (this.assetType != null) {
|
||||
data['assetType'] = this.assetType.toJson();
|
||||
}
|
||||
data['demoRequest'] = this.demoRequest;
|
||||
data['missionCritical'] = this.missionCritical;
|
||||
if (this.site != null) {
|
||||
data['site'] = this.site.toJson();
|
||||
}
|
||||
if (this.building != null) {
|
||||
data['building'] = this.building.toJson();
|
||||
}
|
||||
if (this.floor != null) {
|
||||
data['floor'] = this.floor.toJson();
|
||||
}
|
||||
if (this.department != null) {
|
||||
data['department'] = this.department.toJson();
|
||||
}
|
||||
data['room'] = this.room;
|
||||
data['testsDay'] = this.testsDay;
|
||||
data['purchasingPrice'] = this.purchasingPrice;
|
||||
data['nbv'] = this.nbv;
|
||||
data['currency'] = this.currency;
|
||||
data['poDate'] = this.poDate;
|
||||
data['poNo'] = this.poNo;
|
||||
data['invoiceNumber'] = this.invoiceNumber;
|
||||
data['invoiceDate'] = this.invoiceDate;
|
||||
data['replacementDate'] = this.replacementDate;
|
||||
data['budgetYear'] = this.budgetYear;
|
||||
data['lastPOPrice'] = this.lastPOPrice;
|
||||
data['commissioningStatus'] = this.commissioningStatus?.toJson();
|
||||
if (this.originDepartment != null) {
|
||||
data['originDepartment'] = this.originDepartment.toJson();
|
||||
}
|
||||
if (this.originSite != null) {
|
||||
data['originSite'] = this.originSite.toJson();
|
||||
}
|
||||
data['productionDate'] = this.productionDate;
|
||||
data['edd'] = this.edd;
|
||||
data['technicalInspectionDate'] = this.technicalInspectionDate;
|
||||
data['deliveryInspectionDate'] = this.deliveryInspectionDate;
|
||||
data['endUserAcceptanceDate'] = this.endUserAcceptanceDate;
|
||||
data['technicalAcceptanceDate'] = this.technicalAcceptanceDate;
|
||||
data['finalAcceptanceDate'] = this.finalAcceptanceDate;
|
||||
data['installationDate'] = this.installationDate;
|
||||
data['siteWarrantyMonthNo'] = this.siteWarrantyMonthNo;
|
||||
data['extendedWarrantyMonthNo'] = this.extendedWarrantyMonthNo;
|
||||
data['remainderWarrantyMonthNo'] = this.remainderWarrantyMonthNo;
|
||||
data['eomWarrantyMonthsNo'] = this.eomWarrantyMonthsNo;
|
||||
data['warrantyValue'] = this.warrantyValue;
|
||||
data['warrantyEndDate'] = this.warrantyEndDate;
|
||||
data['warrantyContractConditions'] = this.warrantyContractConditions;
|
||||
if (this.technicalGuidanceBooks != null) {
|
||||
data['technicalGuidanceBooks'] = this.technicalGuidanceBooks.map((v) => v).toList();
|
||||
}
|
||||
data['comment'] = this.comment;
|
||||
data['isEnabled'] = this.isEnabled;
|
||||
data['tagCode'] = this.tagCode;
|
||||
if (this.assetAttachments != null) {
|
||||
data['assetAttachments'] = this.assetAttachments.map((v) => v).toList();
|
||||
}
|
||||
data['retirementTypeName'] = this.retirementTypeName;
|
||||
data['retirementStatusName'] = this.retirementStatusName;
|
||||
data['retirementDate'] = this.retirementDate;
|
||||
if (this.assetGroup != null) {
|
||||
data['assetGroup'] = this.assetGroup.toJson();
|
||||
}
|
||||
data['assetPhoto'] = this.assetPhoto;
|
||||
data['nextPMDate'] = this.nextPMDate;
|
||||
data['lastPMDate'] = this.lastPMDate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class MultiAssets {
|
||||
String assetSerialNo;
|
||||
String systemID;
|
||||
String assetNumber;
|
||||
|
||||
MultiAssets({this.assetSerialNo, this.systemID, this.assetNumber});
|
||||
|
||||
MultiAssets.fromJson(Map<String, dynamic> json) {
|
||||
assetSerialNo = json['assetSerialNo'];
|
||||
systemID = json['systemID'];
|
||||
assetNumber = json['assetNumber'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['assetSerialNo'] = this.assetSerialNo;
|
||||
data['systemID'] = this.systemID;
|
||||
data['assetNumber'] = this.assetNumber;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelDefinition {
|
||||
int id;
|
||||
String assetName;
|
||||
String assetDescription;
|
||||
String modelDefCode;
|
||||
String modelName;
|
||||
int manufacturerId;
|
||||
String manufacturerName;
|
||||
String supplierName;
|
||||
String replacementDate;
|
||||
String essentialEquipement;
|
||||
String businessCritical;
|
||||
int lifeSpan;
|
||||
List<ModelDefRelatedDefects> modelDefRelatedDefects;
|
||||
List<Suppliers> suppliers;
|
||||
|
||||
ModelDefinition(
|
||||
{this.id,
|
||||
this.assetName,
|
||||
this.assetDescription,
|
||||
this.modelDefCode,
|
||||
this.modelName,
|
||||
this.manufacturerId,
|
||||
this.manufacturerName,
|
||||
this.supplierName,
|
||||
this.replacementDate,
|
||||
this.essentialEquipement,
|
||||
this.businessCritical,
|
||||
this.lifeSpan,
|
||||
this.modelDefRelatedDefects,
|
||||
this.suppliers});
|
||||
|
||||
ModelDefinition.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
assetName = json['assetName'];
|
||||
assetDescription = json['assetDescription'];
|
||||
modelDefCode = json['modelDefCode'];
|
||||
modelName = json['modelName'];
|
||||
manufacturerId = json['manufacturerId'];
|
||||
manufacturerName = json['manufacturerName'];
|
||||
supplierName = json['supplierName'];
|
||||
replacementDate = json['replacementDate'];
|
||||
essentialEquipement = json['essentialEquipement'];
|
||||
businessCritical = json['businessCritical'];
|
||||
lifeSpan = json['lifeSpan'];
|
||||
if (json['modelDefRelatedDefects'] != null) {
|
||||
modelDefRelatedDefects = [];
|
||||
json['modelDefRelatedDefects'].forEach((v) {
|
||||
modelDefRelatedDefects.add(ModelDefRelatedDefects.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['suppliers'] != null) {
|
||||
suppliers = <Suppliers>[];
|
||||
json['suppliers'].forEach((v) {
|
||||
suppliers.add(new Suppliers.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['assetName'] = this.assetName;
|
||||
data['assetDescription'] = this.assetDescription;
|
||||
data['modelDefCode'] = this.modelDefCode;
|
||||
data['modelName'] = this.modelName;
|
||||
data['manufacturerId'] = this.manufacturerId;
|
||||
data['manufacturerName'] = this.manufacturerName;
|
||||
data['supplierName'] = this.supplierName;
|
||||
data['replacementDate'] = this.replacementDate;
|
||||
data['essentialEquipement'] = this.essentialEquipement;
|
||||
data['businessCritical'] = this.businessCritical;
|
||||
data['lifeSpan'] = this.lifeSpan;
|
||||
if (this.modelDefRelatedDefects != null) {
|
||||
data['modelDefRelatedDefects'] = this.modelDefRelatedDefects.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.suppliers != null) {
|
||||
data['suppliers'] = this.suppliers.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Suppliers {
|
||||
int id;
|
||||
String suppliername;
|
||||
|
||||
Suppliers({this.id, this.suppliername});
|
||||
|
||||
Suppliers.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
suppliername = json['suppliername'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['suppliername'] = this.suppliername;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AssetReplace {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
|
||||
AssetReplace({this.id, this.name, this.value});
|
||||
|
||||
AssetReplace.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Site {
|
||||
int id;
|
||||
int customerCode;
|
||||
String custName;
|
||||
List<Buildings> buildings;
|
||||
|
||||
Site({this.id, this.customerCode, this.custName, this.buildings});
|
||||
|
||||
Site.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
customerCode = json['customerCode'];
|
||||
custName = json['custName'];
|
||||
if (json['buildings'] != null) {
|
||||
buildings = <Buildings>[];
|
||||
json['buildings'].forEach((v) {
|
||||
buildings.add(new Buildings.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['customerCode'] = this.customerCode;
|
||||
data['custName'] = this.custName;
|
||||
if (this.buildings != null) {
|
||||
data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Buildings {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Floors> floors;
|
||||
|
||||
Buildings({this.id, this.name, this.value, this.floors});
|
||||
|
||||
Buildings.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['floors'] != null) {
|
||||
floors = <Floors>[];
|
||||
json['floors'].forEach((v) {
|
||||
floors.add(new Floors.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
if (this.floors != null) {
|
||||
data['floors'] = this.floors.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Floors {
|
||||
int id;
|
||||
String name;
|
||||
int value;
|
||||
List<Departments> departments;
|
||||
|
||||
Floors({this.id, this.name, this.value, this.departments});
|
||||
|
||||
Floors.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
value = json['value'];
|
||||
if (json['departments'] != null) {
|
||||
departments = <Departments>[];
|
||||
json['departments'].forEach((v) {
|
||||
departments.add(new Departments.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['value'] = this.value;
|
||||
if (this.departments != null) {
|
||||
data['departments'] = this.departments.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Departments {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
Departments({this.id, this.name});
|
||||
|
||||
Departments.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class Department {
|
||||
int id;
|
||||
String departmentName;
|
||||
String departmentCode;
|
||||
String ntCode;
|
||||
|
||||
Department({this.id, this.departmentName, this.departmentCode, this.ntCode});
|
||||
|
||||
Department.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
departmentName = json['departmentName'];
|
||||
departmentCode = json['departmentCode'];
|
||||
ntCode = json['ntCode'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['departmentName'] = this.departmentName;
|
||||
data['departmentCode'] = this.departmentCode;
|
||||
data['ntCode'] = this.ntCode;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AssetGroup {
|
||||
int id;
|
||||
String name;
|
||||
String code;
|
||||
|
||||
AssetGroup({this.id, this.name, this.code});
|
||||
|
||||
AssetGroup.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
code = json['code'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
data['code'] = this.code;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ModelDefRelatedDefects {
|
||||
ModelDefRelatedDefects({
|
||||
this.id,
|
||||
this.defectName,
|
||||
this.workPerformed,
|
||||
this.estimatedTime,
|
||||
});
|
||||
|
||||
ModelDefRelatedDefects.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
defectName = json['defectName'];
|
||||
workPerformed = json['workPerformed'];
|
||||
estimatedTime = json['estimatedTime'];
|
||||
}
|
||||
|
||||
num id;
|
||||
String defectName;
|
||||
String workPerformed;
|
||||
String estimatedTime;
|
||||
|
||||
ModelDefRelatedDefects copyWith({
|
||||
num id,
|
||||
String defectName,
|
||||
String workPerformed,
|
||||
String estimatedTime,
|
||||
}) =>
|
||||
ModelDefRelatedDefects(
|
||||
id: id ?? this.id ?? 0,
|
||||
defectName: defectName ?? this.defectName,
|
||||
workPerformed: workPerformed ?? this.workPerformed,
|
||||
estimatedTime: estimatedTime ?? this.estimatedTime,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['defectName'] = defectName;
|
||||
map['workPerformed'] = workPerformed;
|
||||
map['estimatedTime'] = estimatedTime;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
class AssetInfo {
|
||||
AssetInfo({
|
||||
this.id,
|
||||
this.assetSerialNo,
|
||||
this.assetNumber,
|
||||
this.tagCode,
|
||||
this.systemId,
|
||||
this.assetName,
|
||||
});
|
||||
|
||||
AssetInfo.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
assetSerialNo = json['assetSerialNo'];
|
||||
assetNumber = json['assetNumber'];
|
||||
tagCode = json['tagCode'];
|
||||
systemId = json['systemId'];
|
||||
assetName = json['assetName'];
|
||||
}
|
||||
|
||||
num id;
|
||||
String assetSerialNo;
|
||||
String assetNumber;
|
||||
String tagCode;
|
||||
String systemId;
|
||||
String assetName;
|
||||
|
||||
AssetInfo copyWith({
|
||||
num id,
|
||||
String assetSerialNo,
|
||||
String assetNumber,
|
||||
String tagCode,
|
||||
String systemId,
|
||||
String assetName,
|
||||
}) =>
|
||||
AssetInfo(
|
||||
id: id ?? this.id,
|
||||
assetSerialNo: assetSerialNo ?? this.assetSerialNo,
|
||||
assetNumber: assetNumber ?? this.assetNumber,
|
||||
tagCode: tagCode ?? this.tagCode,
|
||||
systemId: systemId ?? this.systemId,
|
||||
assetName: assetName ?? this.assetName,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['assetSerialNo'] = assetSerialNo;
|
||||
map['assetNumber'] = assetNumber;
|
||||
map['tagCode'] = tagCode;
|
||||
map['systemId'] = systemId;
|
||||
map['assetName'] = assetName;
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
|
||||
import '../../models/device/device.dart';
|
||||
|
||||
class AssetInfoCard extends StatelessWidget {
|
||||
const AssetInfoCard({Key key, @required this.asset}) : super(key: key);
|
||||
|
||||
final Device asset;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
asset.modelDefinition?.assetName?.heading5(context),
|
||||
8.height,
|
||||
"${context.translation.assetNo}: ${asset.assetNumber}".bodyText(context),
|
||||
"${context.translation.manufacture}: ${asset.modelDefinition?.manufacturerName}".bodyText(context),
|
||||
"${context.translation.model}: ${asset.modelDefinition?.modelName}".bodyText(context),
|
||||
"${context.translation.serialNumber}: ${asset.assetNumber}".bodyText(context),
|
||||
const Divider().defaultStyle(context),
|
||||
"${context.translation.department}: ${asset.department?.departmentName}".bodyText(context),
|
||||
"${context.translation.site}: ${asset.site?.custName}".bodyText(context),
|
||||
],
|
||||
).paddingAll(16),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,177 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/controllers/providers/api/devices_provider.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/device/asset_by_id_model.dart';
|
||||
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/failed_loading.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/lazy_loading.dart';
|
||||
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
||||
|
||||
class AssetDetailPage extends StatefulWidget {
|
||||
static const String id = "/asset-details";
|
||||
|
||||
AssetDetailPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AssetDetailPageState createState() {
|
||||
return _AssetDetailPageState();
|
||||
}
|
||||
}
|
||||
|
||||
class _AssetDetailPageState extends State<AssetDetailPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
int assetId;
|
||||
AssetProvider _assetProvider;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
assetId ??= ModalRoute.of(context).settings.arguments;
|
||||
_assetProvider ??= Provider.of<AssetProvider>(context);
|
||||
_assetProvider?.stateCode = null;
|
||||
return Scaffold(
|
||||
appBar: DefaultAppBar(title: context.translation.assetDetails),
|
||||
body: FutureBuilder<AssetByIdModel>(
|
||||
future: _assetProvider.getAssetById(assetId, context.translation),
|
||||
builder: (BuildContext context, AsyncSnapshot<AssetByIdModel> snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return FailedLoading(
|
||||
message: snapshot.error.toString(),
|
||||
onReload: () {
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
}
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: ALoading());
|
||||
} else if (snapshot.hasData) {}
|
||||
if (snapshot.hasData) {
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 159 / 94,
|
||||
child: Container(
|
||||
width: 95,
|
||||
height: 95,
|
||||
decoration: ShapeDecoration(
|
||||
color: const Color(0xFFEAF1F4),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(
|
||||
_assetProvider.assetById?.assetPhoto != null ? URLs.getFileUrl(_assetProvider.assetById.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
||||
)),
|
||||
),
|
||||
),
|
||||
6.height,
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
_assetProvider.assetById?.modelDefinition?.assetName ?? "-",
|
||||
style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)),
|
||||
),
|
||||
8.height,
|
||||
Text(
|
||||
"${context.translation.assetNumber}: ${_assetProvider.assetById.multiAssets.first.assetNumber}",
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"${context.translation.model}: ${_assetProvider.assetById.modelDefinition.modelDefCode}",
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"${context.translation.serialNo}: ${_assetProvider.assetById.multiAssets.first.assetSerialNo}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"MD: ${_assetProvider.assetById.department.departmentName ?? "-"}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"Supplier: ${_assetProvider.assetById.supplier?.suppliername ?? "-"}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"Manufacturer: ${_assetProvider.assetById.modelDefinition.manufacturerName}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"Location: ${_assetProvider.assetById.site.custName}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
8.height,
|
||||
Text(
|
||||
"Installation Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"Next PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"Last PM Date: ${_assetProvider.assetById.installationDate ?? "-"}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
if ((_assetProvider.assetById.modelDefinition.assetDescription ?? "").isNotEmpty) ...[
|
||||
8.height,
|
||||
const Divider(color: Color(0xFFEAF1F4), height: 1, thickness: 1),
|
||||
8.height,
|
||||
Text(
|
||||
_assetProvider.assetById.modelDefinition.assetDescription ?? "-",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
]
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Center(child: ALoading());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
|
||||
import '../../../models/device/device.dart';
|
||||
|
||||
class AssetItemGridView extends StatelessWidget {
|
||||
final Device device;
|
||||
final Function(Device) onPressed;
|
||||
|
||||
const AssetItemGridView({Key key, this.device, this.onPressed}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 159 / 94,
|
||||
child: Container(
|
||||
width: 95,
|
||||
height: 95,
|
||||
decoration: ShapeDecoration(
|
||||
color: const Color(0xFFEAF1F4),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(device.assetPhoto != null ? URLs.getFileUrl(device.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
||||
)),
|
||||
),
|
||||
),
|
||||
6.height,
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
device.modelDefinition.assetName,
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF3B3D4A)),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
"${context.translation.assetNumber} : ${device.assetNumber}",
|
||||
style: AppTextStyles.bodyText2.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"${context.translation.model} : ${device.modelDefinition.modelDefCode}",
|
||||
style: AppTextStyles.bodyText2.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"${context.translation.serialNo} : ${device.assetSerialNo}",
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.fade,
|
||||
style: AppTextStyles.bodyText2.copyWith(
|
||||
color: Color(0xFF757575),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'View Details',
|
||||
style: AppTextStyles.bodyText2.copyWith(color: const Color(0xFF4A8DB7)),
|
||||
),
|
||||
4.width,
|
||||
const Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Color(0xFF4A8DB7),
|
||||
size: 14,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
).expanded
|
||||
],
|
||||
),
|
||||
).onPress(() => onPressed(device));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/controllers/api_routes/urls.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/extensions/int_extensions.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/extensions/widget_extensions.dart';
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
|
||||
import '../../../models/device/device.dart';
|
||||
|
||||
class AssetItemListView extends StatelessWidget {
|
||||
final Device device;
|
||||
final Function(Device) onPressed;
|
||||
|
||||
const AssetItemListView({Key key, this.device, this.onPressed}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
shadows: const [BoxShadow(color: Color(0x07000000), blurRadius: 14, offset: Offset(0, 0), spreadRadius: 0)],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 95,
|
||||
height: 95,
|
||||
decoration: ShapeDecoration(
|
||||
color: const Color(0xFFEAF1F4),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(device.assetPhoto != null ? URLs.getFileUrl(device.assetPhoto) : "https://www.lasteelcraft.com/images/no-image-available.png"),
|
||||
)),
|
||||
),
|
||||
15.width,
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
device.modelDefinition.assetName,
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.heading5.copyWith(color: Color(0xFF3B3D4A)),
|
||||
),
|
||||
Text(
|
||||
"${context.translation.assetNumber} : ${device.assetNumber}",
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
Text(
|
||||
"${context.translation.model} : ${device.modelDefinition.modelDefCode}",
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"${context.translation.serialNo} : ${device.assetSerialNo}",
|
||||
maxLines: 2,
|
||||
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
||||
).expanded,
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'View Details',
|
||||
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
||||
),
|
||||
4.width,
|
||||
const Icon(
|
||||
Icons.arrow_forward,
|
||||
color: Color(0xFF4A8DB7),
|
||||
size: 14,
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
).expanded
|
||||
],
|
||||
),
|
||||
).onPress(() => onPressed(device));
|
||||
}
|
||||
}
|
||||
@ -1,67 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/controllers/localization/localization.dart';
|
||||
import 'package:test_sa/extensions/context_extension.dart';
|
||||
import 'package:test_sa/models/device/device.dart';
|
||||
import 'package:test_sa/models/subtitle.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
|
||||
import '../../../models/device/device.dart';
|
||||
|
||||
class DeviceItem extends StatelessWidget {
|
||||
final Device device;
|
||||
final Function(Device) onPressed;
|
||||
|
||||
const DeviceItem({Key key, this.device, this.onPressed}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: AColors.primaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
onPressed(device);
|
||||
},
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
"${context.translation.assetName} : \n${device.modelDefinition.assetName}",
|
||||
style: Theme.of(context).textTheme.headline6.copyWith(color: AColors.white),
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Divider(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
Text(
|
||||
"${context.translation.assetNumber} : ${device.assetNumber}",
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(color: AColors.white),
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
Text(
|
||||
"${context.translation.brand} : ${device.modelDefinition.manufacturerName}",
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(color: AColors.white),
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
Text(
|
||||
"${context.translation.model} : ${device.modelDefinition.modelName}",
|
||||
style: Theme.of(context).textTheme.subtitle1.copyWith(color: AColors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue