null safety

This commit is contained in:
phyothandar
2021-09-10 12:00:08 +06:30
parent a144c945b6
commit 5e672937b5
67 changed files with 901 additions and 896 deletions

View File

@@ -6,10 +6,10 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CargoTable extends StatefulWidget {
final List<CargoType> cargoTypes;
final List<CargoType>? cargoTypes;
const CargoTable({
Key key,
Key? key,
this.cargoTypes,
}) : super(key: key);
@@ -58,13 +58,13 @@ class _CargoTableState extends State<CargoTable> {
return [];
}
double total = 0;
var rows = widget.cargoTypes.map((c) {
total += c.weight;
var rows = widget.cargoTypes!.map((c) {
total += c.weight!;
return MyDataRow(
onSelectChanged: (bool selected) async {},
cells: [
MyDataCell(new Text(
c.name == null ? "" : c.name,
c.name ?? "",
style: textStyle,
)),
MyDataCell(c.qty == null || c.qty == 0
@@ -81,7 +81,7 @@ class _CargoTableState extends State<CargoTable> {
),
)),
MyDataCell(
Text(c.weight == null ? "0" : c.weight.toStringAsFixed(2),
Text(c.weight == null ? "0" : c.weight!.toStringAsFixed(2),
style: textStyle),
),
],