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

@@ -8,10 +8,10 @@ import 'package:flutter/material.dart';
typedef OnSelect = Function(Package package, bool checked);
class CartonPackageTable extends StatelessWidget {
final List<Package> packages;
final OnSelect onSelect;
final List<Package>? packages;
final OnSelect? onSelect;
const CartonPackageTable({Key key, this.packages, this.onSelect})
const CartonPackageTable({Key? key, this.packages, this.onSelect})
: super(key: key);
@override
@@ -34,20 +34,20 @@ class CartonPackageTable extends StatelessWidget {
final rows = packages == null
? [Container()]
: packages.asMap().entries.map((p) {
: packages!.asMap().entries.map((p) {
return Container(
color: p.value.isChecked
? Colors.grey.withOpacity(0.2)
: Colors.grey[50].withOpacity(0.2),
: Colors.grey.shade50.withOpacity(0.2),
child: Container(
padding: EdgeInsets.only(
left: 0.0, right: 10.0, top: 3.0, bottom: 3.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: p.key == packages.length - 1
color: p.key == packages!.length - 1
? Colors.white
: Colors.grey[350],
: Colors.grey.shade300,
width: 1),
),
),
@@ -62,8 +62,8 @@ class CartonPackageTable extends StatelessWidget {
: Checkbox(
value: p.value.isChecked,
activeColor: primaryColor,
onChanged: (bool check) {
if (onSelect != null) onSelect(p.value, check);
onChanged: (bool? check) {
if (onSelect != null) onSelect!(p.value, check!);
}),
Expanded(
child: Column(
@@ -74,11 +74,11 @@ class CartonPackageTable extends StatelessWidget {
style: textStyle,
),
Text(
p.value.deliveryAddress?.fullName ?? "",
p.value.deliveryAddress.fullName,
style: textStyle,
),
Text(
p.value.deliveryAddress?.phoneNumber ?? "",
p.value.deliveryAddress.phoneNumber,
style: textStyle,
),
],
@@ -88,11 +88,11 @@ class CartonPackageTable extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Text(
p.value?.desc ?? "",
p.value.desc,
style: textStyle,
),
new Text(
"(${p.value?.market ?? ""})",
"(${p.value.market})",
style: textStyle,
)
],