null safety
This commit is contained in:
@@ -11,7 +11,7 @@ import 'package:fcs/pages/widgets/popupmenu.dart';
|
||||
import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -19,7 +19,7 @@ import 'package:provider/provider.dart';
|
||||
import 'fcs_shipment_editor.dart';
|
||||
|
||||
class FcsShipmentInfo extends StatefulWidget {
|
||||
final FcsShipment fcsShipment;
|
||||
final FcsShipment? fcsShipment;
|
||||
FcsShipmentInfo({this.fcsShipment});
|
||||
|
||||
@override
|
||||
@@ -28,7 +28,7 @@ class FcsShipmentInfo extends StatefulWidget {
|
||||
|
||||
class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
var dateFormatter = new DateFormat('dd MMM yyyy');
|
||||
FcsShipment _fcsShipment;
|
||||
FcsShipment? _fcsShipment;
|
||||
bool _isLoading = false;
|
||||
TextEditingController _shipmentNumberController = new TextEditingController();
|
||||
TextEditingController _cutoffDateController = new TextEditingController();
|
||||
@@ -48,17 +48,17 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
}
|
||||
|
||||
_load() {
|
||||
_shipmentNumberController.text = _fcsShipment.shipmentNumber;
|
||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment.cutoffDate);
|
||||
_shipmentNumberController.text = _fcsShipment!.shipmentNumber;
|
||||
_cutoffDateController.text = dateFormatter.format(_fcsShipment!.cutoffDate);
|
||||
_arrivalDateController.text =
|
||||
dateFormatter.format(_fcsShipment.arrivalDate);
|
||||
dateFormatter.format(_fcsShipment!.arrivalDate);
|
||||
_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
|
||||
@@ -166,7 +166,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
portBox,
|
||||
destinationBox,
|
||||
statusBox,
|
||||
_fcsShipment.status == fcs_shipment_confirmed_status
|
||||
_fcsShipment!.status == fcs_shipment_confirmed_status
|
||||
? shipBtn
|
||||
: Container(),
|
||||
SizedBox(
|
||||
@@ -182,14 +182,14 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
}
|
||||
|
||||
_edit() async {
|
||||
bool updated = await Navigator.push<bool>(
|
||||
bool? updated = await Navigator.push<bool>(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => FcsShipmentEditor(shipment: _fcsShipment)),
|
||||
);
|
||||
if (updated ?? false) {
|
||||
var shipmentModel = Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
var f = await shipmentModel.getFcsShipment(_fcsShipment.id);
|
||||
var f = await shipmentModel.getFcsShipment(_fcsShipment!.id);
|
||||
setState(() {
|
||||
_fcsShipment = f;
|
||||
});
|
||||
@@ -238,7 +238,7 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
try {
|
||||
FcsShipmentModel fcsShipmentModel =
|
||||
Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
await fcsShipmentModel.ship(_fcsShipment);
|
||||
await fcsShipmentModel.ship(_fcsShipment!);
|
||||
Navigator.pop(context, true);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
@@ -264,11 +264,11 @@ class _FcsShipmentInfoState extends State<FcsShipmentInfo> {
|
||||
} else if (id == 4) {
|
||||
reportName = "manifest";
|
||||
}
|
||||
_fcsShipment.reportName = reportName;
|
||||
_fcsShipment!.reportName = reportName;
|
||||
|
||||
FcsShipmentModel fcsShipmentModel =
|
||||
Provider.of<FcsShipmentModel>(context, listen: false);
|
||||
String url = await fcsShipmentModel.report(_fcsShipment);
|
||||
String url = await fcsShipmentModel.report(_fcsShipment!);
|
||||
Navigator.of(context).push(CupertinoPageRoute(
|
||||
builder: (context) => PDFScreen(
|
||||
title: "",
|
||||
|
||||
Reference in New Issue
Block a user