From 95e40f31cce7f570cd9074a719c92ce2e293db72 Mon Sep 17 00:00:00 2001 From: peima Date: Sat, 1 Aug 2026 02:27:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(runtime):=20=E5=90=8C=E7=B1=BB=20nullfix=20?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E8=AF=AF=E5=8A=A0=20!=20=E5=85=A8=E5=BA=93?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20-=20getCartInfoByBusiness=20=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=8F=AF=E7=A9=BA=E4=BD=86=E6=9C=AB=E5=B0=BE=E8=AF=AF?= =?UTF-8?q?=E5=8A=A0=20!,=20=E5=90=8E=E6=8E=A5=20if(x!=3Dnull)=20=E5=88=A4?= =?UTF-8?q?=E7=A9=BA.=20=E5=BD=B1=E5=93=8D:=20shopping=5Fcart=5Fbar/shoppi?= =?UTF-8?q?ng=5Fcart=5Fwidget/desktop=5Fshopping=5Fcart=5Fwidget(=E5=8F=AF?= =?UTF-8?q?=E7=A9=BA=E7=9B=AE=E6=A0=87=E5=8E=BB!);=20shop=5Fproducts/mobil?= =?UTF-8?q?e=20shop(=E9=9D=9E=E7=A9=BA=E5=A3=B0=E6=98=8E=E6=94=B9=20CartIn?= =?UTF-8?q?fo=3F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/widgets/desktop/desktop_shopping_cart_widget.dart | 2 +- lib/widgets/desktop/shop_products.dart | 2 +- lib/widgets/desktop/shopping_cart_widget.dart | 2 +- lib/widgets/mobile/shop.dart | 4 ++-- lib/widgets/mobile/shopping_cart_bar.dart | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/widgets/desktop/desktop_shopping_cart_widget.dart b/lib/widgets/desktop/desktop_shopping_cart_widget.dart index 3ba5179..adb564e 100644 --- a/lib/widgets/desktop/desktop_shopping_cart_widget.dart +++ b/lib/widgets/desktop/desktop_shopping_cart_widget.dart @@ -24,7 +24,7 @@ class DesktopShoppingCartWidgetState extends State { @override Widget build(BuildContext context) { totalPrice = 0.0; - cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!; + cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business); if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) { totalPrice = cartInfo!.getTotalPrice(); } diff --git a/lib/widgets/desktop/shop_products.dart b/lib/widgets/desktop/shop_products.dart index 1ce77d6..6119628 100644 --- a/lib/widgets/desktop/shop_products.dart +++ b/lib/widgets/desktop/shop_products.dart @@ -114,7 +114,7 @@ class ShopProductsState extends State { itemBuilder: (BuildContext context, int i) { CategoryProducts cp = _categoryProducts[i]; int qtyInCategory = 0; - CartInfo cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business)!; + CartInfo? cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, _business); if (cartInfo != null && cartInfo.businessInfo!.id == _business.id && cartInfo.productList != null) { diff --git a/lib/widgets/desktop/shopping_cart_widget.dart b/lib/widgets/desktop/shopping_cart_widget.dart index 353ed96..67b472c 100644 --- a/lib/widgets/desktop/shopping_cart_widget.dart +++ b/lib/widgets/desktop/shopping_cart_widget.dart @@ -25,7 +25,7 @@ class ShoppingCartWidgetState extends State { @override Widget build(BuildContext context) { totalPrice = 0.0; - cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!; + cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business); if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) { totalPrice = cartInfo!.getTotalPrice(); } diff --git a/lib/widgets/mobile/shop.dart b/lib/widgets/mobile/shop.dart index 5edf2af..3d6c23b 100644 --- a/lib/widgets/mobile/shop.dart +++ b/lib/widgets/mobile/shop.dart @@ -1136,8 +1136,8 @@ class ShopState extends State itemBuilder: (BuildContext context, int i) { CategoryProducts cp = _categoryProducts![i]; int qtyInCategory = 0; - CartInfo cartInfo = - Utils.getCartInfoByBusiness(store.state.cartInfos, _business!)!; + CartInfo? cartInfo = + Utils.getCartInfoByBusiness(store.state.cartInfos, _business!); if (cartInfo != null && cartInfo.businessInfo!.id == _business!.id && cartInfo.productList != null) { diff --git a/lib/widgets/mobile/shopping_cart_bar.dart b/lib/widgets/mobile/shopping_cart_bar.dart index 215fd1f..3fa6457 100644 --- a/lib/widgets/mobile/shopping_cart_bar.dart +++ b/lib/widgets/mobile/shopping_cart_bar.dart @@ -41,7 +41,7 @@ class ShoppingCartBarState extends State { @override Widget build(BuildContext context) { totalPrice = 0.0; - cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business)!; + cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business); if (cartInfo != null && cartInfo!.businessInfo!.id == widget.business.id) { totalPrice = cartInfo!.getTotalPrice(); }