fix(runtime): add_remove_button cartInfo 误加 ! (nullfix 脚本) -> 去掉. getCartInfoByBusiness 返回可空, 购物车空时 ! 崩溃 -> AddRemoveButton build L197 Unexpected null value. 修复 /shop 商品列表和 /checkout lineItem 的 +/- 按钮崩溃
This commit is contained in:
@@ -61,7 +61,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
Widget build(BuildContext context) {
|
||||
if (widget.product!.leftNum == null) {
|
||||
_qty = 0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business!)!;
|
||||
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
|
||||
@@ -102,7 +102,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
}
|
||||
if (widget.addToBasket) {
|
||||
_qty = 0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business!)!;
|
||||
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) {
|
||||
@@ -194,7 +194,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
|
||||
);
|
||||
} else {
|
||||
_qty = 0;
|
||||
cartInfo = Utils.getCartInfoByBusiness(store.state.cartInfos, widget.business!)!;
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user