null safety

This commit is contained in:
Phaung Phaung
2021-09-10 15:23:13 +06:30
parent 5c5e47b9ad
commit 376153e22f
14 changed files with 80 additions and 66 deletions

View File

@@ -60,9 +60,8 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
@override
void initState() {
super.initState();
if(widget.box != null)
_box = widget.box!;
_selectedCartonType = _box.cartonType;
if (widget.box != null) _box = widget.box!;
_selectedCartonType = _box.cartonType ?? '';
//for shipment weight
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
@@ -81,7 +80,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
_heightController.text = _box.height.toString();
_lengthController.text = _box.length.toString();
_cargoTypes = _box.cargoTypes;
_deliveryAddress = _box.deliveryAddress;
_deliveryAddress = _box.deliveryAddress!;
isMixBox = _box.cartonType == carton_mix_box;
isFromShipments = _box.cartonType == carton_from_shipments;
isFromPackages = _box.cartonType == carton_from_packages;
@@ -97,7 +96,7 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
if (_box.cartonType == carton_from_packages && _box.userID == null) return;
PackageModel packageModel =
Provider.of<PackageModel>(context, listen: false);
List<Package> packages = await packageModel.getPackages(_box.userID, [
List<Package> packages = await packageModel.getPackages(_box.userID!, [
package_processed_status,
package_packed_status,
package_shipped_status,
@@ -136,8 +135,9 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
final cartonTypeBox = LocalRadioButtons(
readOnly: true,
values: cartonModel.cartonTypesInfo,
selectedValue:
_box.isShipmentCarton ? carton_from_shipments : _box.cartonType);
selectedValue: _box.isShipmentCarton ?? false
? carton_from_shipments
: _box.cartonType);
final shipmentBox = DisplayText(
text: _box.fcsShipmentNumber,
labelTextKey: "box.fcs_shipment_num",
@@ -174,11 +174,11 @@ class _DeliveryInfoState extends State<DeliveryInfo> {
children: <Widget>[
Expanded(
child: new Text(
_selectedShipmentBox.shipmentNumber,
_selectedShipmentBox.shipmentNumber ?? "",
style: textStyle,
)),
new Text(
_selectedShipmentBox.desc,
_selectedShipmentBox.desc ?? "",
style: textStyle,
),
],

View File

@@ -42,7 +42,7 @@ class DeliveryModel extends BaseModel {
if (listener != null) listener.cancel();
_cartons = [];
try {
listener = Firestore.instance
listener = FirebaseFirestore.instance
.collection("$path")
.where("status", isEqualTo: carton_shipped_status)
.where("carton_type", whereIn: [