phase3: targeted local-var nullable (strict type) + nullfix cascade. 379->309
This commit is contained in:
@@ -134,7 +134,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
controller: scrollController,
|
||||
itemCount: orders != null && orders.length > 0 ? orders.length + 1 : 1,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
Order order;
|
||||
Order? order;
|
||||
if (orders != null && orders.length > 0 && position < orders.length) {
|
||||
order = orders[position];
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
row.children.add(Expanded(
|
||||
child: Container(
|
||||
child: Text(
|
||||
order.cartInfo!.productList![0].name,
|
||||
order!.cartInfo!.productList![0].name,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
),
|
||||
@@ -190,10 +190,10 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
),
|
||||
));
|
||||
if (order.cartInfo!.productList!.length > 1) {
|
||||
if (order!.cartInfo!.productList!.length > 1) {
|
||||
row.children.add(Container(
|
||||
child: Text(
|
||||
S.of(context).and_more_item_token(Utils.getProductLineInOrder(order.cartInfo!)),
|
||||
S.of(context).and_more_item_token(Utils.getProductLineInOrder(order!.cartInfo!)),
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.black26,
|
||||
@@ -205,7 +205,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
width: 80.0,
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'\$${order.totalPrice!.toStringAsFixed(2)}',
|
||||
'\$${order!.totalPrice!.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -222,13 +222,13 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,),
|
||||
builder: (BuildContext context) => OrderDetail(order!.id!, fromOrders: true,),
|
||||
));
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
if (order.status == Constants.STATUS_COMPLETE && !order.hasComment) {
|
||||
if (order!.status == Constants.STATUS_COMPLETE && !order!.hasComment) {
|
||||
row3.children.add(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10.0),
|
||||
@@ -237,7 +237,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
S.of(context).comment,
|
||||
),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context, '/new-comment/${order.id}');
|
||||
Routes.router.navigateTo(context, '/new-comment/${order!.id}');
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -249,11 +249,11 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[],
|
||||
);
|
||||
if (order.paymentStatus != Constants.PAYMENT_STATUS_PAID) {
|
||||
if (order!.paymentStatus != Constants.PAYMENT_STATUS_PAID) {
|
||||
row2.children.add(row3);
|
||||
if (order.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||
&& order.status != Constants.STATUS_CANCELLED
|
||||
&& order.status != Constants.STATUS_COMPLETE) {
|
||||
if (order!.paymentStatus != Constants.PAYMENT_STATUS_PAID
|
||||
&& order!.status != Constants.STATUS_CANCELLED
|
||||
&& order!.status != Constants.STATUS_COMPLETE) {
|
||||
row2.children.add(ElevatedButton(
|
||||
child: Text(
|
||||
S.of(context)
|
||||
@@ -266,7 +266,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
backgroundColor: Colors.redAccent,
|
||||
),
|
||||
onPressed: () {
|
||||
Routes.router.navigateTo(context, '/paynow/${order.id}');
|
||||
Routes.router.navigateTo(context, '/paynow/${order!.id}');
|
||||
},
|
||||
));
|
||||
} else {
|
||||
@@ -281,7 +281,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
onPressed: () {
|
||||
Utils.orderAgain(context, order.cartInfo!);
|
||||
Utils.orderAgain(context, order!.cartInfo!);
|
||||
},
|
||||
));
|
||||
}
|
||||
@@ -298,7 +298,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
onPressed: () {
|
||||
Utils.orderAgain(context, order.cartInfo!);
|
||||
Utils.orderAgain(context, order!.cartInfo!);
|
||||
},
|
||||
));
|
||||
}
|
||||
@@ -320,7 +320,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Util.showImage('${order.cartInfo!.businessInfo!.picUrl}',
|
||||
child: Util.showImage('${order!.cartInfo!.businessInfo!.picUrl}',
|
||||
width: 32.0,
|
||||
height: 32.0,
|
||||
fit: BoxFit.fill,
|
||||
@@ -336,7 +336,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
'${order.cartInfo!.businessInfo!.name}',
|
||||
'${order!.cartInfo!.businessInfo!.name}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
),
|
||||
@@ -346,7 +346,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'#${order.orderNum} ${Utils.timestampToString(context, order.createdAt!, withTime: true)}',
|
||||
'#${order!.orderNum} ${Utils.timestampToString(context, order!.createdAt!, withTime: true)}',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.black26,
|
||||
@@ -358,7 +358,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,),
|
||||
builder: (BuildContext context) => OrderDetail(order!.id!, fromOrders: true,),
|
||||
));
|
||||
},
|
||||
),
|
||||
@@ -369,7 +369,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
'${Utils.getOrderStatus(context, order.status!)}',
|
||||
'${Utils.getOrderStatus(context, order!.status!)}',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -404,7 +404,7 @@ class DesktopOrdersState extends State<DesktopOrders> with SingleTickerProviderS
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,),
|
||||
builder: (BuildContext context) => OrderDetail(order!.id!, fromOrders: true,),
|
||||
));
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user