phase3: FIX arg-bang regex (missing \] in char class skipped subscripts). 235->183

This commit is contained in:
2026-07-31 14:57:23 +08:00
parent 70076d71c1
commit 18abf4eb82
15 changed files with 51 additions and 51 deletions

View File

@@ -380,7 +380,7 @@ class AddRemoveButtonState extends State<AddRemoveButton> {
void _removeCartLineItem() {
if (cartInfo.productList![widget.cartLineItemIndex].quantity! <= 1) {
String uuid = cartInfo.productList![widget.cartLineItemIndex].uuid;
String uuid = cartInfo.productList![widget.cartLineItemIndex].uuid!;
cartInfo.productList!.removeAt(widget.cartLineItemIndex);
Utils.removeSubproduct(cartInfo, uuid);
} else {

View File

@@ -50,7 +50,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
S.of(context).check_option_select_token(product.productAttributes![this.index].name),
S.of(context).check_option_select_token(product.productAttributes![this.index].name!),
style: new TextStyle(
fontSize: 12.5,
),
@@ -95,7 +95,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
'adjust_amount': adjustAmount
};
var cloneSelections = json.decode(json.encode(selections));
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes![index].name, name);
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes![index].name!, name);
if (idx != -1) {
(cloneSelections[product.productAttributes![index].name!.toUpperCase()] as List).removeAt(idx);
} else if (cloneSelections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
@@ -108,7 +108,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
cloneSelections.remove(product.productAttributes![index].name!.toUpperCase());
}
setOptionsStateDisabled(product.productAttributes![index].name, false);
setOptionsStateDisabled(product.productAttributes![index].name!, false);
setState(() {
selections = cloneSelections;
@@ -121,14 +121,14 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
children: <Widget>[],
);
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
List<ProductOption> productOptions = product.productAttributes![index].productOptions!;
if (!optionsState.containsKey(product.productAttributes![index].name)) {
List<Map<String, dynamic>> optionState = [];
for (var i = 0; i < productOptions.length; i++) {
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'check': false});
}
optionsState[product.productAttributes![index].name] = optionState;
optionsState[product.productAttributes![index].name!] = optionState;
}
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
@@ -199,7 +199,7 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
} else {
if (_checkOptionIsCheck(productOptions[i].name!)) {
setOptionsStateDisabled(
product.productAttributes![index].name, true);
product.productAttributes![index].name!, true);
optionsState[product.productAttributes![index]
.name][i]['disabled'] = false;
break;
@@ -232,16 +232,16 @@ class CheckOptionsState extends OptionsBaseState<CheckOptions> {
}
void disableOptionIfNotSelected() {
setOptionsStateDisabled(product.productAttributes![index].name, true);
setOptionsStateDisabled(product.productAttributes![index].name!, true);
for (var i = 0; i < optionsState[product.productAttributes![index].name].length; i++) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name, optionsState[product.productAttributes![index].name][i]['name']) != -1) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name!, optionsState[product.productAttributes![index].name][i]['name']) != -1) {
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
}
}
}
bool _checkOptionIsCheck(String name) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name!, name) != -1) {
return true;
}
return false;

View File

@@ -41,7 +41,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
S.of(context).check_option_select_token(product.productAttributes![this.index].name),
S.of(context).check_option_select_token(product.productAttributes![this.index].name!),
style: new TextStyle(
fontSize: 12.5,
),
@@ -86,7 +86,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
'adjust_amount': adjustAmount
};
var cloneSelections = json.decode(json.encode(selections));
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes![index].name, name);
int idx = Utils.selectionsContains(cloneSelections, product.productAttributes![index].name!, name);
if (idx != -1) {
if (quantity == 1) {
cloneSelections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'] += 1;
@@ -112,7 +112,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
cloneSelections.remove(product.productAttributes![index].name!.toUpperCase());
}
setOptionsStateDisabled(product.productAttributes![index].name, false);
setOptionsStateDisabled(product.productAttributes![index].name!, false);
setState(() {
selections = cloneSelections;
@@ -125,19 +125,19 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
children: <Widget>[],
);
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
List<ProductOption> productOptions = product.productAttributes![index].productOptions!;
if (!optionsState.containsKey(product.productAttributes![index].name)) {
List<Map<String, dynamic>> optionState = [];
for (var i = 0; i < productOptions.length; i++) {
int qty = 0;
int idx = Utils.selectionsContains(selections, product.productAttributes![index].name, productOptions[i].name!);
int idx = Utils.selectionsContains(selections, product.productAttributes![index].name!, productOptions[i].name!);
if (idx != -1) {
qty = selections[product.productAttributes![index].name!.toUpperCase()][idx]['quantity'];
}
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'quantity': qty, 'check': false});
}
optionsState[product.productAttributes![index].name] = optionState;
optionsState[product.productAttributes![index].name!] = optionState;
}
if (selections.containsKey(product.productAttributes![index].name!.toUpperCase())) {
@@ -207,7 +207,7 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
} else {
if (_checkOptionIsCheck(productOptions[i].name!)) {
setOptionsStateDisabled(
product.productAttributes![index].name, true);
product.productAttributes![index].name!, true);
optionsState[product.productAttributes![index]
.name][i]['disabled'] = false;
break;
@@ -240,16 +240,16 @@ class QtyOptionsState extends OptionsBaseState<QtyOptions> {
}
void disableOptionIfNotSelected() {
setOptionsStateDisabled(product.productAttributes![index].name, true);
setOptionsStateDisabled(product.productAttributes![index].name!, true);
for (var i = 0; i < optionsState[product.productAttributes![index].name].length; i++) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name, optionsState[product.productAttributes![index].name][i]['name']) != -1) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name!, optionsState[product.productAttributes![index].name][i]['name']) != -1) {
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
}
}
}
bool _checkOptionIsCheck(String name) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name!, name) != -1) {
return true;
}
return false;

View File

@@ -40,7 +40,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
S.of(context).radio_option_select_token(product.productAttributes![this.index].name),
S.of(context).radio_option_select_token(product.productAttributes![this.index].name!),
style: new TextStyle(
fontSize: 12.5,
),
@@ -102,7 +102,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
if (exclusiveRule != null) {
if (_checkOptionIsCheck(productOption.name!)) {
setOptionsStateDisabled(product.productAttributes![index].name, false);
setOptionsStateDisabled(product.productAttributes![index].name!, false);
}
}
}
@@ -118,24 +118,24 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
children: <Widget>[],
);
List<ProductOption> productOptions = product.productAttributes![index].productOptions;
List<ProductOption> productOptions = product.productAttributes![index].productOptions!;
if (!optionsState.containsKey(product.productAttributes![index].name)) {
List<Map<String, dynamic>> optionState = [];
for (var i = 0; i < productOptions.length; i++) {
optionState.add({'name': product.productAttributes![index].productOptions![i].name, 'disabled': false, 'check': false});
}
optionsState[product.productAttributes![index].name] = optionState;
optionsState[product.productAttributes![index].name!] = optionState;
}
for (var i = 0; i < productOptions.length; i++) {
Map<String, dynamic> extraJson = Utils.stringToJson(productOptions[i].extra!);
Map<String, dynamic> extraJson = Utils.stringToJson(productOptions[i].extra!)!;
if (extraJson != null) {
Map<String, dynamic> exclusiveRule = Rule.getRule(
extraJson, Rule.RULE_EXCLUSIVE_SELECTION);
if (exclusiveRule != null) {
if (_checkOptionIsCheck(productOptions[i].name!)) {
setOptionsStateDisabled(product.productAttributes![index].name, true);
setOptionsStateDisabled(product.productAttributes![index].name!, true);
optionsState[product.productAttributes![index].name][i]['disabled'] = false;
break;
}
@@ -153,7 +153,7 @@ class RadioOptionsState extends OptionsBaseState<RadioOptions> {
}
bool _checkOptionIsCheck(String name) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name, name) != -1) {
if (Utils.selectionsContains(selections, product.productAttributes![index].name!, name) != -1) {
return true;
}
return false;