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

@@ -23,7 +23,7 @@ import '../../widgets/general/navigationbar.dart';
import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart';
class DesktopBlog extends StatefulWidget {
final int businessId;
final int? businessId;
const DesktopBlog({Key? key, this.businessId}) : super(key: key);
@override

View File

@@ -19,7 +19,7 @@ import '../../widgets/general/breadcrumbs.dart';
import '../../widgets/general/navigationbar.dart';
class DesktopMyAddresses extends StatefulWidget {
final int businessId;
final int? businessId;
const DesktopMyAddresses({Key? key, this.businessId}) : super(key: key);
@override
@@ -208,7 +208,7 @@ class DesktopMyAddressesState extends State<DesktopMyAddresses> {
),
),
Container(
child: widget.businessId > 0 ? IconButton(
child: widget.businessId! > 0 ? IconButton(
icon: Icon(
Icons.check,
color: Colors.grey,

View File

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

View File

@@ -15,8 +15,8 @@ import '../../widgets/general/navigationbar.dart';
class DesktopNewAddress extends StatefulWidget {
final Key? key;
final LocatedAddress locatedAddress;
final int businessId;
final LocatedAddress? locatedAddress;
final int? businessId;
const DesktopNewAddress({this.key, this.locatedAddress, this.businessId}) : super(key: key);
@override
@@ -377,15 +377,15 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
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';
}
@@ -399,7 +399,7 @@ class DesktopNewAddressState extends State<DesktopNewAddress> {
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

@@ -28,7 +28,7 @@ import '../../widgets/general/navigationbar.dart';
class DesktopOrderDetail extends StatefulWidget {
final Key? key;
final int orderId;
final bool fromOrders;
final bool? fromOrders;
const DesktopOrderDetail(this.orderId, {this.key, this.fromOrders});
@override

View File

@@ -13,8 +13,8 @@ import '../../widgets/general/style.dart';
import 'desktop_product_detail_page.dart';
class DesktopProductItem extends StatefulWidget {
final Product product;
final Business business;
final Product? product;
final Business? business;
final bool horizontal;
DesktopProductItem({this.product, this.business, Key? key, this.horizontal = false})
@@ -60,7 +60,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
width: 110.0,
height: 110.0,
child: GestureDetector(
child: Util.showImage('${widget.product.imagePath}',
child: Util.showImage('${widget.product!.imagePath}',
fit: BoxFit.fill,
),
onTap: (){
@@ -76,7 +76,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
Container(
child: GestureDetector(
child: Text(
'${widget.product.name}',
'${widget.product!.name}',
// overflow: kIsWeb ? null : TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
maxLines: 2,
@@ -91,7 +91,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
),
),
Text(
widget.product.description,
widget.product!.description,
// overflow: kIsWeb ? null : TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
maxLines: 2,
@@ -107,17 +107,17 @@ class DesktopProductItemState extends State<DesktopProductItem> {
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
),
) : SizedBox.shrink(),
),
ShowPrice(
widget.product.price,
regularPrice: widget.product.regularPrice,
widget.product!.price,
regularPrice: widget.product!.regularPrice,
currencySign: '\$',
fontWeight: FontWeight.bold,
),
@@ -142,7 +142,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
width: 110.0,
height: 110.0,
child: GestureDetector(
child: Util.showImage('${widget.product.imagePath}',
child: Util.showImage('${widget.product!.imagePath}',
fit: BoxFit.fill,
),
onTap: (){
@@ -158,7 +158,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
Container(
child: GestureDetector(
child: Text(
'${widget.product.name}',
'${widget.product!.name}',
// overflow: kIsWeb ? null : TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
maxLines: 2,
@@ -174,7 +174,7 @@ class DesktopProductItemState extends State<DesktopProductItem> {
),
Container(
child: Text(
widget.product.description,
widget.product!.description,
// overflow: kIsWeb ? null : TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis,
maxLines: 2,
@@ -191,17 +191,17 @@ class DesktopProductItemState extends State<DesktopProductItem> {
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
),
) : SizedBox.shrink(),
),
ShowPrice(
widget.product.price,
regularPrice: widget.product.regularPrice,
widget.product!.price,
regularPrice: widget.product!.regularPrice,
currencySign: '\$',
fontWeight: FontWeight.bold,
),

View File

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

View File

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

View File

@@ -9,7 +9,7 @@ import '../../utils/utils.dart';
class DesktopShoppingCartWidget extends StatefulWidget {
final Business business;
final Function onTap;
final Function? onTap;
DesktopShoppingCartWidget({@required this.business, this.onTap});

View File

@@ -22,7 +22,7 @@ import 'shop_promote.dart';
import 'shopping_cart_widget.dart';
class Shop extends StatefulWidget {
final int businessId;
final int? businessId;
const Shop({Key? key, this.businessId}): super(key: key);

View File

@@ -10,7 +10,7 @@ import '../../utils/utils.dart';
class ShoppingCartWidget extends StatefulWidget {
final Business business;
final Function onTap;
final Function? onTap;
ShoppingCartWidget({@required this.business, this.onTap});