check null safety

This commit is contained in:
tzw
2021-09-10 16:33:52 +06:30
parent 3eacbef117
commit d8c86a512b
46 changed files with 275 additions and 304 deletions

View File

@@ -8,8 +8,8 @@ import 'package:intl/intl.dart';
import 'carton_info.dart';
class CartonListRow extends StatelessWidget {
final Carton? box;
CartonListRow({Key? key, this.box}) : super(key: key);
final Carton box;
CartonListRow({Key? key, required this.box}) : super(key: key);
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@@ -47,7 +47,7 @@ class CartonListRow extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
box!.cartonNumber ,
box.cartonNumber ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
@@ -55,7 +55,7 @@ class CartonListRow extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
box!.userName,
box.userName ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
@@ -71,14 +71,14 @@ class CartonListRow extends StatelessWidget {
children: <Widget>[
Padding(
padding: const EdgeInsets.all(0),
child: getStatus(box!.status == null ? "" : box!.status),
child: getStatus(box.status ?? ""),
),
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
child: Row(
children: <Widget>[
new Text(
"${box!.cartonWeight.toStringAsFixed(2)} lb",
"${box.cartonWeight?.toStringAsFixed(2)} lb",
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),