43 lines
946 B
Dart
43 lines
946 B
Dart
class CartonSize {
|
|
String? id;
|
|
String? name;
|
|
double length;
|
|
double width;
|
|
double height;
|
|
CartonSize(
|
|
{this.id, this.name, this.length = 0, this.width = 0, this.height = 0});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'name': name,
|
|
'length': length,
|
|
'width': width,
|
|
'height': height,
|
|
};
|
|
}
|
|
|
|
factory CartonSize.fromMap(Map<String, dynamic> map, String id) {
|
|
return CartonSize(
|
|
id: id,
|
|
name: map['name'],
|
|
length: map['length'],
|
|
width: map['width'],
|
|
height: map['height'],
|
|
);
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) => other is CartonSize && other.id == id;
|
|
|
|
@override
|
|
int get hashCode => id.hashCode;
|
|
|
|
bool isChangedForEdit(CartonSize cartonSize) {
|
|
return cartonSize.name != this.name ||
|
|
cartonSize.length != this.length ||
|
|
cartonSize.width != this.width ||
|
|
cartonSize.height != this.height;
|
|
}
|
|
}
|