From a6d5b9cd2dd0596a05d6a0357778fe965939456c Mon Sep 17 00:00:00 2001 From: peima Date: Fri, 31 Jul 2026 15:00:04 +0800 Subject: [PATCH] phase3: fix attribute widgets (qty/check/radio) - prefix-! bug, multi-line toUpperCase, required conditions. ~30 fixed --- lib/widgets/general/attribute/check_options.dart | 16 ++++++++-------- lib/widgets/general/attribute/qty_options.dart | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/widgets/general/attribute/check_options.dart b/lib/widgets/general/attribute/check_options.dart index e94e1b2..14f6ae1 100644 --- a/lib/widgets/general/attribute/check_options.dart +++ b/lib/widgets/general/attribute/check_options.dart @@ -57,7 +57,7 @@ class CheckOptionsState extends OptionsBaseState { overflow: TextOverflow.ellipsis, ), new Text( - product.productAttributes![this.index].required ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional, + product.productAttributes![this.index].required == true ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional, style: new TextStyle( fontSize: 10.0, color: new Color(0xFF999999) @@ -133,8 +133,8 @@ class CheckOptionsState extends OptionsBaseState { if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) { - Map attrExtraJson = Utils.stringToJson(! - product.productAttributes![index].extra); + Map? attrExtraJson = Utils.stringToJson( + product.productAttributes![index].extra!); if (attrExtraJson != null) { var selectLimitIfFieldEqualsTo = Rule.getRule( attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO); @@ -147,7 +147,7 @@ class CheckOptionsState extends OptionsBaseState { int limitQty = selectLimitIfFieldEqualsTo1[Rule .RULE_KEY_FORCE_LIMITED]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -155,7 +155,7 @@ class CheckOptionsState extends OptionsBaseState { if (selectLimitIfFieldEqualsTo1.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0])) { int limitQty = selectLimitIfFieldEqualsTo1[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0]]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -168,7 +168,7 @@ class CheckOptionsState extends OptionsBaseState { int limitQty = selectLimitIfFieldEqualsTo[Rule .RULE_KEY_FORCE_LIMITED]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -176,7 +176,7 @@ class CheckOptionsState extends OptionsBaseState { if (selectLimitIfFieldEqualsTo.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0])) { int limitQty = selectLimitIfFieldEqualsTo[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0]]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -187,7 +187,7 @@ class CheckOptionsState extends OptionsBaseState { } for (var i = 0; i < productOptions.length; i++) { - Map extraJson = Utils.stringToJson(! + Map? extraJson = Utils.stringToJson( productOptions[i].extra!); if (extraJson != null) { Map exclusiveRule = Rule.getRule( diff --git a/lib/widgets/general/attribute/qty_options.dart b/lib/widgets/general/attribute/qty_options.dart index 6482103..c1aebcb 100644 --- a/lib/widgets/general/attribute/qty_options.dart +++ b/lib/widgets/general/attribute/qty_options.dart @@ -48,7 +48,7 @@ class QtyOptionsState extends OptionsBaseState { overflow: TextOverflow.ellipsis, ), new Text( - product.productAttributes![this.index].required ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional, + product.productAttributes![this.index].required == true ? S.of(context).check_option_is_required : S.of(context).check_option_is_optional, style: new TextStyle( fontSize: 10.0, color: new Color(0xFF999999) @@ -141,8 +141,8 @@ class QtyOptionsState extends OptionsBaseState { } if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) { - Map attrExtraJson = Utils.stringToJson(! - product.productAttributes![index].extra); + Map? attrExtraJson = Utils.stringToJson( + product.productAttributes![index].extra!); if (attrExtraJson != null) { var selectLimitIfFieldEqualsTo = Rule.getRule( attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO); @@ -155,7 +155,7 @@ class QtyOptionsState extends OptionsBaseState { int limitQty = selectLimitIfFieldEqualsTo1[Rule .RULE_KEY_FORCE_LIMITED]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -163,7 +163,7 @@ class QtyOptionsState extends OptionsBaseState { if (selectLimitIfFieldEqualsTo1.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0])) { int limitQty = selectLimitIfFieldEqualsTo1[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0]]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -176,7 +176,7 @@ class QtyOptionsState extends OptionsBaseState { int limitQty = selectLimitIfFieldEqualsTo[Rule .RULE_KEY_FORCE_LIMITED]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -184,7 +184,7 @@ class QtyOptionsState extends OptionsBaseState { if (selectLimitIfFieldEqualsTo.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0])) { int limitQty = selectLimitIfFieldEqualsTo[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0]]; thisLimitQty = limitQty; - if ((selections[product.productAttributes![index].name + if ((selections[product.productAttributes![index].name! .toUpperCase()] as List).length >= limitQty) { disableOptionIfNotSelected(); } @@ -195,7 +195,7 @@ class QtyOptionsState extends OptionsBaseState { } for (var i = 0; i < productOptions.length; i++) { - Map extraJson = Utils.stringToJson(! + Map? extraJson = Utils.stringToJson( productOptions[i].extra!); if (extraJson != null) { Map exclusiveRule = Rule.getRule(