phase3: nullfix field-formal field-nullable handler. 907 -> 872

This commit is contained in:
2026-07-25 18:14:55 +08:00
parent fce670664b
commit c21ccbd54d
38 changed files with 151 additions and 131 deletions

View File

@@ -20,7 +20,7 @@ class MobileAttributeSelection extends StatefulWidget {
final Product product;
final Business business;
final Key? key;
final GlobalKey startKey;
final GlobalKey? startKey;
const MobileAttributeSelection({@required this.product, @required this.business, this.key, this.startKey})
: super(key: key);

View File

@@ -17,7 +17,7 @@ import '../../utils/utils.dart';
import '../../widgets/mobile/MobileBottomNav.dart';
class MobileBlog extends StatefulWidget {
final int businessId;
final int? businessId;
const MobileBlog({Key? key, this.businessId}) : super(key: key);
@override

View File

@@ -16,7 +16,7 @@ import 'package:flutter_wisetronic/widgets/mobile/MobileBottomNav.dart';
import '../../routes.dart';
class MobileMyAddresses extends StatefulWidget {
final int businessId;
final int? businessId;
const MobileMyAddresses({Key? key, this.businessId}) : super(key: key);
@override
@@ -162,7 +162,7 @@ class MobileMyAddressesState extends State<MobileMyAddresses> {
),
),
Container(
child: widget.businessId > 0 ? IconButton(
child: widget.businessId! > 0 ? IconButton(
icon: Icon(
Icons.check,
color: Colors.grey,

View File

@@ -17,7 +17,7 @@ import '../../widgets/general/double_back_to_close_app_wrapper.dart';
import '../../widgets/mobile/MobileBottomNav.dart';
class MobileMySupport extends StatefulWidget {
final int businessId;
final int? businessId;
const MobileMySupport({Key? key, this.businessId}) : super(key: key);
@override

View File

@@ -12,8 +12,8 @@ import '../../utils/http_util.dart';
class MobileNewAddress extends StatefulWidget {
final Key? key;
final LocatedAddress locatedAddress;
final int businessId;
final LocatedAddress? locatedAddress;
final int? businessId;
const MobileNewAddress({this.key, this.locatedAddress, this.businessId}) : super(key: key);
@override
@@ -348,15 +348,15 @@ class MobileNewAddressState extends State<MobileNewAddress> {
super.initState();
setState(() {
if (widget.locatedAddress != null) {
if (provinces.contains(widget.locatedAddress.province)) {
_selectedProvince = widget.locatedAddress.province;
if (provinces.contains(widget.locatedAddress!.province)) {
_selectedProvince = widget.locatedAddress!.province;
}
cityController.text = widget.locatedAddress.city;
postalCodeController.text = widget.locatedAddress.postalCode;
streetLine1Controller.text = (widget.locatedAddress.streetNumber != null
&& widget.locatedAddress.streetNumber!.isNotEmpty
? widget.locatedAddress.streetNumber! + ' ' : '')
+ widget.locatedAddress.streetName;
cityController.text = widget.locatedAddress!.city;
postalCodeController.text = widget.locatedAddress!.postalCode;
streetLine1Controller.text = (widget.locatedAddress!.streetNumber != null
&& widget.locatedAddress!.streetNumber!.isNotEmpty
? widget.locatedAddress!.streetNumber! + ' ' : '')
+ widget.locatedAddress!.streetName;
} else {
_selectedProvince = 'Ontario';
}
@@ -370,7 +370,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
if (form.validate()) {
HttpUtil.httpPost('v1/addresses', (response) {
if (widget.businessId > 0) {
if (widget.businessId! > 0) {
Routes.router.navigateTo(context, '/checkout/${widget.businessId}', replace: true);
} else {
Routes.router.navigateTo(context, '/my-addresses/${widget.businessId}', replace: true);

View File

@@ -26,7 +26,7 @@ import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dar
class MobileOrderDetail extends StatefulWidget {
final Key? key;
final int orderId;
final bool fromOrders;
final bool? fromOrders;
const MobileOrderDetail(this.orderId, {this.key, this.fromOrders});
@override

View File

@@ -12,8 +12,8 @@ import '../../widgets/general/show_price.dart';
import '../../widgets/general/style.dart';
class MobileProductItem extends StatefulWidget {
final Product product;
final Business business;
final Product? product;
final Business? business;
MobileProductItem({this.product, this.business, Key? key})
: super(key: key);
@@ -49,7 +49,7 @@ class MobileProductItemState extends State<MobileProductItem> {
width: 80.0,
height: 80.0,
child: GestureDetector(
child: Util.showImage('${widget.product.imagePath}',
child: Util.showImage('${widget.product!.imagePath}',
fit: BoxFit.fill,
),
onTap: (){
@@ -65,7 +65,7 @@ class MobileProductItemState extends State<MobileProductItem> {
Container(
child: GestureDetector(
child: Text(
'${widget.product.name}',
'${widget.product!.name}',
// overflow: kIsWeb ? null : TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
maxLines: 2,
@@ -80,7 +80,7 @@ class MobileProductItemState extends State<MobileProductItem> {
),
),
new Text(
widget.product.description,
widget.product!.description,
// overflow: kIsWeb ? null : TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
maxLines: 2,
@@ -96,9 +96,9 @@ class MobileProductItemState extends State<MobileProductItem> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Container(
child: widget.business.showMonthlySold ?
child: widget.business!.showMonthlySold ?
Text(
S.of(context).sold_per_month_token(widget.product.monthSales!.toStringAsFixed(0)),
S.of(context).sold_per_month_token(widget.product!.monthSales!.toStringAsFixed(0)),
style: new TextStyle(
fontSize: 9.0
),
@@ -110,8 +110,8 @@ class MobileProductItemState extends State<MobileProductItem> {
textBaseline: TextBaseline.alphabetic,
children: <Widget>[
ShowPrice(
widget.product.price,
regularPrice: widget.product.regularPrice,
widget.product!.price,
regularPrice: widget.product!.regularPrice,
currencySign: '\$',
),
],

View File

@@ -10,7 +10,7 @@ import '../../utils/utils.dart';
class MobileResetPassword extends StatefulWidget {
final String mobile;
final String code;
final String? code;
const MobileResetPassword(this.mobile, {this.code, Key? key})
: super(key: key);

View File

@@ -10,7 +10,7 @@ import '../../utils/utils.dart';
class MobileSetPassword extends StatefulWidget {
final String mobile;
final String code;
final String? code;
const MobileSetPassword(this.mobile, {Key? key, this.code}) : super(key: key);

View File

@@ -43,7 +43,7 @@ late double screenWidth;
late double screenHeight;
class Shop extends StatefulWidget {
final int businessId;
final int? businessId;
const Shop({Key? key, this.businessId}) : super(key: key);

View File

@@ -17,10 +17,10 @@ typedef OnEmptyCartListener();
typedef OnPanelOpenCloseRequest();
class ShoppingCartBar extends StatefulWidget {
final GlobalKey endKey;
final GlobalKey? endKey;
final Business business;
final OnEmptyCartListener onEmptyCartListener;
final OnPanelOpenCloseRequest onPanelOpenCloseRequest;
final OnEmptyCartListener? onEmptyCartListener;
final OnPanelOpenCloseRequest? onPanelOpenCloseRequest;
final bool barAtBottom;
final bool hasPicture;
ShoppingCartBar({@required this.business, this.endKey,