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});

View File

@@ -17,8 +17,8 @@ import '../../store/store.dart';
import '../../utils/utils.dart';
class AddRemoveButton extends StatefulWidget {
final Product product;
final Business business;
final Product? product;
final Business? business;
final bool addOnly;
final int cartLineItemIndex;
final bool addToBasket;
@@ -59,12 +59,12 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
@override
Widget build(BuildContext context) {
if (widget.product.leftNum == null) {
if (widget.product!.leftNum == null) {
_qty = 0;
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
if (cartInfo != null) {
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.id == widget.product.id
if (cartInfo.productList![i].product!.id == widget.product!.id
&& cartInfo.productList![i].unitPrice == 0.0) {
_qty = cartInfo.productList![i].quantity!.round();
break;
@@ -78,7 +78,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
),
);
}
if (widget.product.leftNum! <= 0) {
if (widget.product!.leftNum! <= 0) {
return Container(
padding: EdgeInsets.only(top: 0.0, bottom: 10.0, left: 8.0, right: 8.0),
child: Text(
@@ -105,7 +105,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
if (cartInfo != null) {
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.id == widget.product.id) {
if (cartInfo.productList![i].product!.id == widget.product!.id) {
_qty = cartInfo.productList![i].quantity!.round();
break;
}
@@ -198,14 +198,14 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business);
if (cartInfo != null) {
for (var i = 0; i < cartInfo.productList!.length; i++) {
if (cartInfo.productList![i].product!.id == widget.product.id) {
if (cartInfo.productList![i].product!.id == widget.product!.id) {
_qty = cartInfo.productList![i].quantity!.round();
break;
}
}
}
if (widget.product.productAttributes != null &&
widget.product.productAttributes!.length > 0 && widget.cartLineItemIndex == -1) {
if (widget.product!.productAttributes != null &&
widget.product!.productAttributes!.length > 0 && widget.cartLineItemIndex == -1) {
return new Row(
key: startKey,
crossAxisAlignment: CrossAxisAlignment.end,
@@ -312,7 +312,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
void _addToCart(BuildContext context) {
if (widget.cartLineItemIndex != -1) {
if (cartInfo.productList![widget.cartLineItemIndex].quantity! + 1.0 > widget.product.leftNum) {
if (cartInfo.productList![widget.cartLineItemIndex].quantity! + 1.0 > widget.product!.leftNum) {
Fluttertoast.showToast(
msg: S.of(context).product_insufficient,
toastLength: Toast.LENGTH_SHORT,
@@ -328,7 +328,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
eventBus.fire(new OnCartInfoUpdated());
}
} else {
if (widget.product.productAttributes!.length > 0) {
if (widget.product!.productAttributes!.length > 0) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>
@@ -337,7 +337,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
);
} else {
eventBus.fire(new OnProductWillAddToCart(widget.product, {},
widget.product.price, widget.product.description,
widget.product!.price, widget.product!.description,
widget.business, buttonKey: startKey));
}
}

View File

@@ -12,7 +12,7 @@ import '../../utils/utils.dart';
class DownloadItem extends StatefulWidget {
final dynamic desc;
final double width;
final double? width;
const DownloadItem(this.desc, {Key? key, this.width}) : super(key: key);
@override
@@ -52,7 +52,7 @@ class DownloadItemState extends State<DownloadItem> {
margin: EdgeInsets.only(right: 16.0),
),
Container(
width: widget.width != null ? widget.width - iconWidth - buttonWidth - 60 : MediaQuery.of(context).size.width - iconWidth - buttonWidth - 60,
width: widget.width != null ? widget.width! - iconWidth - buttonWidth - 60 : MediaQuery.of(context).size.width - iconWidth - buttonWidth - 60,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,

View File

@@ -28,16 +28,16 @@ class ReadMoreText extends StatefulWidget {
final String data;
final String trimExpandedText;
final String trimCollapsedText;
final Color colorClickableText;
final Color? colorClickableText;
final int trimLength;
final int trimLines;
final TrimMode trimMode;
final TextStyle style;
final TextAlign textAlign;
final TextDirection textDirection;
final Locale locale;
final double textScaleFactor;
final String semanticsLabel;
final TextStyle? style;
final TextAlign? textAlign;
final TextDirection? textDirection;
final Locale? locale;
final double? textScaleFactor;
final String? semanticsLabel;
@override
ReadMoreTextState createState() => ReadMoreTextState();
@@ -58,7 +58,7 @@ class ReadMoreTextState extends State<ReadMoreText> {
Widget build(BuildContext context) {
final DefaultTextStyle defaultTextStyle = DefaultTextStyle.of(context);
TextStyle effectiveTextStyle = widget.style;
if (widget.style == null || widget.style.inherit) {
if (widget.style == null || widget.style!.inherit) {
effectiveTextStyle = defaultTextStyle.style.merge(widget.style);
}

View File

@@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
class ShowPrice extends StatelessWidget {
final double price;
final double regularPrice;
final double? regularPrice;
final double largeFontSize;
final double smallFontSize;
final String currencySign;
final String? currencySign;
final Color color;
final FontWeight fontWeight;
@@ -65,12 +65,12 @@ class ShowPrice extends StatelessWidget {
),
),
),
regularPrice == null || price.round() >= regularPrice.round() ?
regularPrice == null || price.round() >= regularPrice!.round() ?
SizedBox.shrink() :
Container(
padding: EdgeInsets.only(top: largeFontSize / 2),
child: Text(
regularPrice.toStringAsFixed(0),
regularPrice!.toStringAsFixed(0),
style: TextStyle(
color: Colors.black38,
fontSize: smallFontSize,

View File

@@ -30,7 +30,7 @@ class SlidingUpPanel extends StatefulWidget {
/// otherwise, [collapsed] will be displayed overtop
/// of this Widget. If [panel] and [panelBuilder] are both non-null,
/// [panel] will be used.
final Widget panel;
final Widget? panel;
/// WARNING: This feature is still in beta and is subject to change without
/// notice. Stability is not gauranteed. Provides a [ScrollController] and
@@ -38,28 +38,28 @@ class SlidingUpPanel extends StatefulWidget {
/// the panel position with the scroll position. Useful for implementing an
/// infinite scroll behavior. If [panel] and [panelBuilder] are both non-null,
/// [panel] will be used.
final Widget Function(ScrollController sc) panelBuilder;
final Widget Function(ScrollController sc)? panelBuilder;
/// The Widget displayed overtop the [panel] when collapsed.
/// This fades out as the panel is opened.
final Widget collapsed;
final Widget? collapsed;
/// The Widget that lies underneath the sliding panel.
/// This Widget automatically sizes itself
/// to fill the screen.
final Widget body;
final Widget? body;
/// Optional persistent widget that floats above the [panel] and attaches
/// to the top of the [panel]. Content at the top of the panel will be covered
/// by this widget. Add padding to the bottom of the `panel` to
/// avoid coverage.
final Widget header;
final Widget? header;
/// Optional persistent widget that floats above the [panel] and
/// attaches to the bottom of the [panel]. Content at the bottom of the panel
/// will be covered by this widget. Add padding to the bottom of the `panel`
/// to avoid coverage.
final Widget footer;
final Widget? footer;
/// The height of the sliding panel when fully collapsed.
final double minHeight;
@@ -72,13 +72,13 @@ class SlidingUpPanel extends StatefulWidget {
/// and go directly to the open/close position. This value is represented as a
/// percentage of the total animation distance ([maxHeight] - [minHeight]),
/// so it must be between 0.0 and 1.0, exclusive.
final double snapPoint;
final double? snapPoint;
/// A border to draw around the sliding panel sheet.
final Border border;
final Border? border;
/// If non-null, the corners of the sliding panel sheet are rounded by this [BorderRadiusGeometry].
final BorderRadiusGeometry borderRadius;
final BorderRadiusGeometry? borderRadius;
/// A list of shadows cast behind the sliding panel sheet.
final List<BoxShadow> boxShadow;
@@ -87,10 +87,10 @@ class SlidingUpPanel extends StatefulWidget {
final Color color;
/// The amount to inset the children of the sliding panel sheet.
final EdgeInsetsGeometry padding;
final EdgeInsetsGeometry? padding;
/// Empty space surrounding the sliding panel sheet.
final EdgeInsetsGeometry margin;
final EdgeInsetsGeometry? margin;
/// Set to false to not to render the sheet the [panel] sits upon.
/// This means that only the [body], [collapsed], and the [panel]
@@ -104,7 +104,7 @@ class SlidingUpPanel extends StatefulWidget {
final bool panelSnapping;
/// If non-null, this can be used to control the state of the panel.
final PanelController controller;
final PanelController? controller;
/// If non-null, shows a darkening shadow over the [body] as the panel slides open.
final bool backdropEnabled;
@@ -125,15 +125,15 @@ class SlidingUpPanel extends StatefulWidget {
/// is called as the panel slides around with the
/// current position of the panel. The position is a double
/// between 0.0 and 1.0 where 0.0 is fully collapsed and 1.0 is fully open.
final void Function(double position) onPanelSlide;
final void Function(double position)? onPanelSlide;
/// If non-null, this callback is called when the
/// panel is fully opened
final VoidCallback onPanelOpened;
final VoidCallback? onPanelOpened;
/// If non-null, this callback is called when the panel
/// is fully collapsed.
final VoidCallback onPanelClosed;
final VoidCallback? onPanelClosed;
/// If non-null and true, the SlidingUpPanel exhibits a
/// parallax effect as the panel slides up. Essentially,
@@ -320,8 +320,8 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
top: widget.slideDirection == SlideDirection.UP ? 0.0 : null,
bottom: widget.slideDirection == SlideDirection.DOWN ? 0.0 : null,
width: MediaQuery.of(context).size.width -
(widget.margin != null ? widget.margin.horizontal : 0) -
(widget.padding != null ? widget.padding.horizontal : 0),
(widget.margin != null ? widget.margin!.horizontal : 0) -
(widget.padding != null ? widget.padding!.horizontal : 0),
child: Container(
height: widget.maxHeight,
child: widget.panel != null
@@ -349,8 +349,8 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid
top: widget.slideDirection == SlideDirection.UP ? 0.0 : null,
bottom: widget.slideDirection == SlideDirection.DOWN ? 0.0 : null,
width: MediaQuery.of(context).size.width -
(widget.margin != null ? widget.margin.horizontal : 0) -
(widget.padding != null ? widget.padding.horizontal : 0),
(widget.margin != null ? widget.margin!.horizontal : 0) -
(widget.padding != null ? widget.padding!.horizontal : 0),
child: Container(
height: widget.minHeight,
child: widget.collapsed == null ? Container() : FadeTransition(

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,