cleanup code
This commit is contained in:
@@ -50,9 +50,9 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
if (widget.box != null) {
|
||||
_box = widget.box;
|
||||
_isNew = false;
|
||||
_lengthCtl.text = _box!.length != null ? _box!.length.toString() : '';
|
||||
_widthCtl.text = _box!.width != null ? _box!.width.toString() : '';
|
||||
_heightCtl.text = _box!.height != null ? _box!.height.toString() : '';
|
||||
_lengthCtl.text = _box!.length.toString();
|
||||
_widthCtl.text = _box!.width.toString();
|
||||
_heightCtl.text = _box!.height.toString();
|
||||
} else {
|
||||
var shipmentModel =
|
||||
Provider.of<DeliveryAddressModel>(context, listen: false);
|
||||
@@ -86,7 +86,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
labelTextKey: "shipment.box.shipment.weight",
|
||||
text: shipmentWeight == null ? "" : shipmentWeight.toStringAsFixed(0),
|
||||
text: shipmentWeight.toStringAsFixed(0),
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
|
||||
@@ -212,7 +212,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
}
|
||||
|
||||
List<DataRow> getCargoRows(BuildContext context) {
|
||||
if (_box!.cargoTypes == null) {
|
||||
if (_box!.cargoTypes.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
double total = 0;
|
||||
@@ -238,8 +238,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
|
||||
style: textStyle),
|
||||
Text(c.weight.toStringAsFixed(2), style: textStyle),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove_circle,
|
||||
@@ -281,7 +280,7 @@ class _ShipmentBoxEditorState extends State<ShipmentBoxEditor> {
|
||||
return rows;
|
||||
}
|
||||
|
||||
_addCargo(CargoType cargo) {
|
||||
_addCargo(CargoType? cargo) {
|
||||
if (cargo == null) return;
|
||||
setState(() {
|
||||
_box!.cargoTypes.remove(cargo);
|
||||
|
||||
Reference in New Issue
Block a user