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,9 +8,9 @@ import 'package:intl/intl.dart';
typedef OnRemove(Carton carton);
class CartonRow extends StatelessWidget {
final Carton? box;
final Carton box;
final OnRemove? onRemove;
CartonRow({Key? key, this.box, this.onRemove}) : super(key: key);
CartonRow({Key? key, required this.box, this.onRemove}) : super(key: key);
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@@ -45,7 +45,7 @@ class CartonRow 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),
),
@@ -53,7 +53,7 @@ class CartonRow 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),
),
@@ -75,16 +75,16 @@ class CartonRow extends StatelessWidget {
color: primaryColor,
),
onPressed: () {
if (onRemove != null) onRemove!(box!);
if (onRemove != null) onRemove!(box);
}),
box!.actualWeight == 0
box.actualWeight == 0
? Container()
: Padding(
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
child: Row(
children: <Widget>[
new Text(
"${box!.actualWeight.toStringAsFixed(2)} lb",
"${box.actualWeight.toStringAsFixed(2)} lb",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),