null safety
This commit is contained in:
@@ -13,7 +13,7 @@ import 'package:fcs/pages/widgets/progress.dart';
|
||||
import 'package:fcs/pages/widgets/status_tree.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:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -22,7 +22,7 @@ import 'receiving_editor.dart';
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
|
||||
class ReceivingInfo extends StatefulWidget {
|
||||
final Package package;
|
||||
final Package? package;
|
||||
ReceivingInfo({this.package});
|
||||
|
||||
@override
|
||||
@@ -30,14 +30,14 @@ class ReceivingInfo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
Package _package;
|
||||
Package? _package;
|
||||
bool _isLoading = false;
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
initPackage(widget.package);
|
||||
initPackage(widget.package!);
|
||||
}
|
||||
|
||||
initPackage(Package package) {
|
||||
@@ -57,22 +57,22 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
bool isCustomer = Provider.of<MainModel>(context).isCustomer();
|
||||
|
||||
final trackingIdBox = DisplayText(
|
||||
text: _package.trackingID,
|
||||
text: _package!.trackingID,
|
||||
labelTextKey: "package.tracking.id",
|
||||
iconData: MaterialCommunityIcons.barcode_scan,
|
||||
);
|
||||
var fcsIDBox = DisplayText(
|
||||
text: _package.fcsID,
|
||||
text: _package!.fcsID,
|
||||
labelTextKey: "processing.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
);
|
||||
final customerNameBox = DisplayText(
|
||||
text: _package.userName,
|
||||
text: _package!.userName,
|
||||
labelTextKey: "package.create.name",
|
||||
iconData: Icons.perm_identity,
|
||||
);
|
||||
final remarkBox = DisplayText(
|
||||
text: _package.remark ?? "-",
|
||||
text: _package!.remark ?? "-",
|
||||
labelTextKey: "package.edit.remark",
|
||||
iconData: Entypo.new_message,
|
||||
);
|
||||
@@ -123,10 +123,10 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
fcsIDBox,
|
||||
customerNameBox,
|
||||
remarkBox,
|
||||
_package.photoUrls.length == 0 ? Container() : img,
|
||||
_package!.photoUrls.length == 0 ? Container() : img,
|
||||
StatusTree(
|
||||
shipmentHistory: _package.shipmentHistory,
|
||||
currentStatus: _package.status),
|
||||
shipmentHistory: _package!.shipmentHistory,
|
||||
currentStatus: _package!.status),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
@@ -149,7 +149,7 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
);
|
||||
PackageModel packageModel =
|
||||
Provider.of<PackageModel>(context, listen: false);
|
||||
var pkg = await packageModel.getPackage(widget.package.id);
|
||||
var pkg = await packageModel.getPackage(widget.package!.id);
|
||||
initPackage(pkg);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ class _ReceivingInfoState extends State<ReceivingInfo> {
|
||||
try {
|
||||
PackageModel packageModel =
|
||||
Provider.of<PackageModel>(context, listen: false);
|
||||
await packageModel.deleteReceiving(_package);
|
||||
await packageModel.deleteReceiving(_package!);
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
showMsgDialog(context, "Error", e.toString());
|
||||
|
||||
Reference in New Issue
Block a user