null safety

This commit is contained in:
phyothandar
2021-09-10 15:22:11 +06:30
parent 51a5fe0740
commit c90661b262
24 changed files with 194 additions and 193 deletions

View File

@@ -38,7 +38,7 @@ class InvoiceCartonTable extends StatelessWidget {
? [Container()]
: cartons!.asMap().entries.map((p) {
return Container(
color: p.value.isChecked
color: p.value.isChecked!
? Colors.grey.withOpacity(0.2)
: Colors.grey.shade50.withOpacity(0.2),
child: Container(
@@ -56,7 +56,7 @@ class InvoiceCartonTable extends StatelessWidget {
child: Row(
children: <Widget>[
onSelect == null
? p.value.isChecked
? p.value.isChecked!
? SizedBox(
child: Icon(Icons.check, color: primaryColor),
width: 30)
@@ -72,7 +72,7 @@ class InvoiceCartonTable extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
p.value.cartonNumber,
p.value.cartonNumber!,
style: textStyle,
),
],

View File

@@ -68,7 +68,7 @@ class InvoiceDiscountList extends StatelessWidget {
onSelectChanged: (value) => Navigator.pop(context, c),
cells: [
MyDataCell(new Text(
c.code,
c.code!,
style: textStyle,
)),
MyDataCell(

View File

@@ -91,7 +91,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_loadCartons() async {
CartonModel cartonModel = Provider.of<CartonModel>(context, listen: false);
List<Carton> cartons = await cartonModel.getCartonsForInvoice(
widget.fcsShipment!.id, widget.customer!.id);
widget.fcsShipment!.id!, widget.customer!.id!);
cartons.forEach((c) {
c.isChecked = true;
});
@@ -104,7 +104,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
ShipmentModel shipmentModel =
Provider.of<ShipmentModel>(context, listen: false);
List<Shipment> shipments = await shipmentModel.getShipmentWithHandlingFee(
widget.fcsShipment!.id, widget.customer!.id);
widget.fcsShipment!.id!, widget.customer!.id!);
shipments.forEach((s) {
s.isSelected = true;
});
@@ -117,7 +117,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_loadDiscount() async {
DiscountModel discountModel =
Provider.of<DiscountModel>(context, listen: false);
discounts = await discountModel.getDiscount(widget.customer!.id);
discounts = (await discountModel.getDiscount(widget.customer!.id!))!;
if (discounts != null && discounts.length > 0) {
setState(() {
_invoice!.discount = discounts.first;
@@ -281,7 +281,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(dateFormatter.format(_invoice!.invoiceDate)),
Text(dateFormatter.format(_invoice!.invoiceDate!)),
SizedBox(
height: 10,
),
@@ -429,7 +429,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
invoice.cargoTypes = cargoTypes;
invoice.amount = amount;
invoice.handlingFee = _invoice!.getHandlingFee();
invoice.cartons = _invoice!.cartons.where((c) => c.isChecked).toList();
invoice.cartons = _invoice!.cartons.where((c) => c.isChecked!).toList();
invoice.shipments =
_invoice!.shipments.where((s) => s.isSelected).toList();
invoice.discount = _invoice!.discount;

View File

@@ -72,7 +72,7 @@ class InvoiceHandlingFeeList extends StatelessWidget {
onSelectChanged: (value) => Navigator.pop(context, c),
cells: [
MyDataCell(new Text(
c.shipmentNumber,
c.shipmentNumber!,
style: textStyle,
)),
MyDataCell(