phase3: fix attribute widgets (qty/check/radio) - prefix-! bug, multi-line toUpperCase, required conditions. ~30 fixed

This commit is contained in:
2026-07-31 15:00:04 +08:00
parent 18abf4eb82
commit a6d5b9cd2d
2 changed files with 16 additions and 16 deletions

View File

@@ -57,7 +57,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
new Text( 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( style: new TextStyle(
fontSize: 10.0, fontSize: 10.0,
color: new Color(0xFF999999) color: new Color(0xFF999999)
@@ -133,8 +133,8 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) { if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
Map<String, dynamic> attrExtraJson = Utils.stringToJson(! Map<String, dynamic>? attrExtraJson = Utils.stringToJson(
product.productAttributes![index].extra); product.productAttributes![index].extra!);
if (attrExtraJson != null) { if (attrExtraJson != null) {
var selectLimitIfFieldEqualsTo = Rule.getRule( var selectLimitIfFieldEqualsTo = Rule.getRule(
attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO); attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO);
@@ -147,7 +147,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
int limitQty = selectLimitIfFieldEqualsTo1[Rule int limitQty = selectLimitIfFieldEqualsTo1[Rule
.RULE_KEY_FORCE_LIMITED]; .RULE_KEY_FORCE_LIMITED];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -155,7 +155,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
if (selectLimitIfFieldEqualsTo1.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0])) { 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]]; int limitQty = selectLimitIfFieldEqualsTo1[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0]];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -168,7 +168,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
int limitQty = selectLimitIfFieldEqualsTo[Rule int limitQty = selectLimitIfFieldEqualsTo[Rule
.RULE_KEY_FORCE_LIMITED]; .RULE_KEY_FORCE_LIMITED];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -176,7 +176,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
if (selectLimitIfFieldEqualsTo.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0])) { 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]]; int limitQty = selectLimitIfFieldEqualsTo[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0]];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -187,7 +187,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
} }
for (var i = 0; i < productOptions.length; i++) { for (var i = 0; i < productOptions.length; i++) {
Map<String, dynamic> extraJson = Utils.stringToJson(! Map<String, dynamic>? extraJson = Utils.stringToJson(
productOptions[i].extra!); productOptions[i].extra!);
if (extraJson != null) { if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule( Map<String, dynamic> exclusiveRule = Rule.getRule(

View File

@@ -48,7 +48,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
new Text( 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( style: new TextStyle(
fontSize: 10.0, fontSize: 10.0,
color: new Color(0xFF999999) color: new Color(0xFF999999)
@@ -141,8 +141,8 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
} }
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) { if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
Map<String, dynamic> attrExtraJson = Utils.stringToJson(! Map<String, dynamic>? attrExtraJson = Utils.stringToJson(
product.productAttributes![index].extra); product.productAttributes![index].extra!);
if (attrExtraJson != null) { if (attrExtraJson != null) {
var selectLimitIfFieldEqualsTo = Rule.getRule( var selectLimitIfFieldEqualsTo = Rule.getRule(
attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO); attrExtraJson, Rule.RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO);
@@ -155,7 +155,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
int limitQty = selectLimitIfFieldEqualsTo1[Rule int limitQty = selectLimitIfFieldEqualsTo1[Rule
.RULE_KEY_FORCE_LIMITED]; .RULE_KEY_FORCE_LIMITED];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -163,7 +163,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
if (selectLimitIfFieldEqualsTo1.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0])) { 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]]; int limitQty = selectLimitIfFieldEqualsTo1[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo1[Rule.RULE_KEY_FIELD_KEY])[0]];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -176,7 +176,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
int limitQty = selectLimitIfFieldEqualsTo[Rule int limitQty = selectLimitIfFieldEqualsTo[Rule
.RULE_KEY_FORCE_LIMITED]; .RULE_KEY_FORCE_LIMITED];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -184,7 +184,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
if (selectLimitIfFieldEqualsTo.containsKey(Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0])) { 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]]; int limitQty = selectLimitIfFieldEqualsTo[Utils.getSelectedAttributeValue(selections, selectLimitIfFieldEqualsTo[Rule.RULE_KEY_FIELD_KEY])[0]];
thisLimitQty = limitQty; thisLimitQty = limitQty;
if ((selections[product.productAttributes![index].name if ((selections[product.productAttributes![index].name!
.toUpperCase()] as List).length >= limitQty) { .toUpperCase()] as List).length >= limitQty) {
disableOptionIfNotSelected(); disableOptionIfNotSelected();
} }
@@ -195,7 +195,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
} }
for (var i = 0; i < productOptions.length; i++) { for (var i = 0; i < productOptions.length; i++) {
Map<String, dynamic> extraJson = Utils.stringToJson(! Map<String, dynamic>? extraJson = Utils.stringToJson(
productOptions[i].extra!); productOptions[i].extra!);
if (extraJson != null) { if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule( Map<String, dynamic> exclusiveRule = Rule.getRule(