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

@@ -5,27 +5,15 @@ import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'carton_search.dart';
class CartonListRow extends StatefulWidget {
class CartonListRow extends StatelessWidget {
final CallbackCartonSelect? callbackCartonSelect;
final Carton? carton;
final Carton carton;
// const CartonListRow({this.carton, this.callbackCartonSelect});
CartonListRow(
{Key? key, this.carton, this.callbackCartonSelect})
CartonListRow({Key? key, required this.carton, this.callbackCartonSelect})
: super(key: key);
@override
_CartonListRowState createState() => _CartonListRowState();
}
class _CartonListRowState extends State<CartonListRow> {
final double dotSize = 15.0;
Carton? _carton;
@override
void initState() {
super.initState();
this._carton = widget.carton;
}
@override
Widget build(BuildContext context) {
@@ -38,8 +26,7 @@ class _CartonListRowState extends State<CartonListRow> {
child: InkWell(
onTap: () {
Navigator.pop(context);
if (widget.callbackCartonSelect != null)
widget.callbackCartonSelect!(widget.carton!);
if (callbackCartonSelect != null) callbackCartonSelect!(carton);
},
child: Row(
children: <Widget>[
@@ -64,7 +51,7 @@ class _CartonListRowState extends State<CartonListRow> {
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_carton!.cartonNumber,
carton.cartonNumber ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
@@ -72,7 +59,7 @@ class _CartonListRowState extends State<CartonListRow> {
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
_carton!.userName,
carton.userName ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
@@ -86,7 +73,7 @@ class _CartonListRowState extends State<CartonListRow> {
child: Row(
children: <Widget>[
new Text(
"${_carton!.cartonWeight.toStringAsFixed(2)} lb",
"${carton.cartonWeight?.toStringAsFixed(2)} lb",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),