phase3: targeted local-var nullable (strict type) + nullfix cascade. 379->309

This commit is contained in:
2026-07-26 10:47:55 +08:00
parent 3ed58e1596
commit 1aa7cf3477
6 changed files with 39 additions and 39 deletions

View File

@@ -189,7 +189,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
), ),
), ),
); );
Map<String, dynamic> existing_web_svc; Map<String, dynamic>? existing_web_svc;
if (selectedStore != null && (selectedStore['services'] as List).length > 0) { if (selectedStore != null && (selectedStore['services'] as List).length > 0) {
for (Map<String, dynamic>svc in (selectedStore['services'] as List)) { for (Map<String, dynamic>svc in (selectedStore['services'] as List)) {
if (svc['code'] == Constants.WEB_MINISTORE_SERVICE) { if (svc['code'] == Constants.WEB_MINISTORE_SERVICE) {
@@ -241,8 +241,8 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
Navigator.pushReplacement(context, MaterialPageRoute( Navigator.pushReplacement(context, MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE, BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE,
domain: existing_web_svc['domain'], domain: existing_web_svc!['domain'],
sid: existing_web_svc['store']['id'], sid: existing_web_svc!['store']['id'],
), ),
)); ));
}, },

View File

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

View File

@@ -186,9 +186,9 @@ class DownloadItemState extends State<DownloadItem> {
} }
Widget getDownloadButton() { Widget getDownloadButton() {
String downloadUrl; String? downloadUrl;
String os = Utils.getOs(); String os = Utils.getOs();
String selectedOs; String? selectedOs;
List<String> supportedOss = []; List<String> supportedOss = [];
for (int i = 0; i < (widget.desc['urls'] as List).length; i++) { for (int i = 0; i < (widget.desc['urls'] as List).length; i++) {
supportedOss.add((widget.desc['urls'] as List)[i]['os']); supportedOss.add((widget.desc['urls'] as List)[i]['os']);
@@ -255,7 +255,7 @@ class DownloadItemState extends State<DownloadItem> {
padding: EdgeInsets.only(right: 0.0, left: 6.0, top: 6.0, bottom: 6.0), padding: EdgeInsets.only(right: 0.0, left: 6.0, top: 6.0, bottom: 6.0),
child: Icon( child: Icon(
IconData( IconData(
Utils.getOsFontHex(selectedOs), Utils.getOsFontHex(selectedOs!),
fontFamily: 'wisetronic', fontFamily: 'wisetronic',
fontPackage: null fontPackage: null
), ),

View File

@@ -136,7 +136,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
), ),
), ),
); );
Map<String, dynamic> existing_web_svc; Map<String, dynamic>? existing_web_svc;
if (selectedStore != null && (selectedStore['services'] as List).length > 0) { if (selectedStore != null && (selectedStore['services'] as List).length > 0) {
for (Map<String, dynamic>svc in (selectedStore['services'] as List)) { for (Map<String, dynamic>svc in (selectedStore['services'] as List)) {
if (svc['code'] == Constants.WEB_MINISTORE_SERVICE) { if (svc['code'] == Constants.WEB_MINISTORE_SERVICE) {
@@ -188,8 +188,8 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
Navigator.pushReplacement(context, MaterialPageRoute( Navigator.pushReplacement(context, MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE, BuyService(group.id!, Constants.WEB_MINISTORE_SERVICE,
domain: existing_web_svc['domain'], domain: existing_web_svc!['domain'],
sid: existing_web_svc['store']['id'], sid: existing_web_svc!['store']['id'],
), ),
)); ));
}, },

View File

@@ -350,7 +350,7 @@ class MobileMeState extends State<MobileMe> {
controller: _listScrollController1, controller: _listScrollController1,
itemCount: 7, itemCount: 7,
itemBuilder: (BuildContext context, int i) { itemBuilder: (BuildContext context, int i) {
Widget item; Widget? item;
switch (i) { switch (i) {
case 0: case 0:
item = GestureDetector( item = GestureDetector(

View File

@@ -129,7 +129,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
return ListView.builder( return ListView.builder(
itemCount: orders != null && orders.length > 0 ? orders.length : 1, itemCount: orders != null && orders.length > 0 ? orders.length : 1,
itemBuilder: (BuildContext context, int position) { itemBuilder: (BuildContext context, int position) {
Order order; Order? order;
if (orders != null && orders.length > 0) { if (orders != null && orders.length > 0) {
order = orders[position]; order = orders[position];
} }
@@ -193,7 +193,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
), ),
onPressed: () { onPressed: () {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), builder: (BuildContext context) => OrderDetail(order!.id!, fromOrders: true,),
)); ));
}, },
), ),
@@ -208,7 +208,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
S.of(context).comment, S.of(context).comment,
), ),
onPressed: () { onPressed: () {
Routes.router.navigateTo(context, '/new-comment/${order.id}'); Routes.router.navigateTo(context, '/new-comment/${order!.id}');
}, },
), ),
), ),
@@ -237,7 +237,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
backgroundColor: Colors.redAccent, backgroundColor: Colors.redAccent,
), ),
onPressed: () { onPressed: () {
Routes.router.navigateTo(context, '/paynow/${order.id}'); Routes.router.navigateTo(context, '/paynow/${order!.id}');
}, },
)); ));
} else { } else {
@@ -252,7 +252,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),
onPressed: () { onPressed: () {
Utils.orderAgain(context, order.cartInfo!); Utils.orderAgain(context, order!.cartInfo!);
}, },
)); ));
} }
@@ -269,7 +269,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,
), ),
onPressed: () { onPressed: () {
Utils.orderAgain(context, order.cartInfo!); Utils.orderAgain(context, order!.cartInfo!);
}, },
)); ));
} }
@@ -329,7 +329,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
), ),
onTap: () { onTap: () {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), builder: (BuildContext context) => OrderDetail(order!.id!, fromOrders: true,),
)); ));
}, },
), ),
@@ -375,7 +375,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
), ),
onTap: () { onTap: () {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => OrderDetail(order.id!, fromOrders: true,), builder: (BuildContext context) => OrderDetail(order!.id!, fromOrders: true,),
)); ));
}, },
), ),