null safety
This commit is contained in:
@@ -48,17 +48,20 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
}
|
||||
|
||||
_load() {
|
||||
_shipmentNumberController.text = _fcsShipment!.shipmentNumber;
|
||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment!.cutoffDate);
|
||||
_shipmentNumberController.text = _fcsShipment!.shipmentNumber ?? "";
|
||||
if(_fcsShipment!.cutoffDate != null)
|
||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment!.cutoffDate!);
|
||||
if(_fcsShipment!.arrivalDate != null)
|
||||
_arrivalDateController.text =
|
||||
dateFormatter.format(_fcsShipment!.arrivalDate);
|
||||
dateFormatter.format(_fcsShipment!.arrivalDate!);
|
||||
if(_fcsShipment!.departureDate != null)
|
||||
_departureDateControler.text =
|
||||
dateFormatter.format(_fcsShipment!.departureDate);
|
||||
_shipmentTypeControler.text = _fcsShipment!.shipType;
|
||||
_consigneeController.text = _fcsShipment!.consignee;
|
||||
_portController.text = _fcsShipment!.port;
|
||||
_destinationController.text = _fcsShipment!.destination;
|
||||
_statusController.text = _fcsShipment!.status;
|
||||
dateFormatter.format(_fcsShipment!.departureDate!);
|
||||
_shipmentTypeControler.text = _fcsShipment!.shipType ?? "";
|
||||
_consigneeController.text = _fcsShipment!.consignee ?? "";
|
||||
_portController.text = _fcsShipment!.port ?? "";
|
||||
_destinationController.text = _fcsShipment!.destination ?? "";
|
||||
_statusController.text = _fcsShipment!.status ?? "";
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -182,6 +185,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
}
|
||||
|
||||
_edit() async {
|
||||
var f;
|
||||
bool? updated = await Navigator.push<bool>(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
@@ -189,7 +193,8 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
);
|
||||
if (updated ?? false) {
|
||||
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
var f = await shipmentModel.getFcsShipment(_fcsShipment!.id);
|
||||
if(_fcsShipment != null && _fcsShipment!.id != null )
|
||||
f = await shipmentModel.getFcsShipment(_fcsShipment!.id!);
|
||||
setState(() {
|
||||
_fcsShipment = f;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user