backup. before shop update
This commit is contained in:
27
lib/widgets/general/attribute/rules.dart
Normal file
27
lib/widgets/general/attribute/rules.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
class Rule {
|
||||
static final String rulesName = 'rules';
|
||||
static final String RULE_ADJUSTMENT_BASED_ON_SELECTED_FIELD_VALUE = "adjustment-based-on-selected-field-value";
|
||||
static final String RULE_SELECT_LIMIT_IF_FIELD_EQUALS_TO = "select-limit-if-field-equals-to";
|
||||
static final String RULE_DISABLED_IF_FIELD_EQUALS_TO = "disabled-if-field-equals-to";
|
||||
static final String RULE_EXCLUSIVE_SELECTION = "exclusive-selection";
|
||||
static final String RULE_MAX_QTY_LIMIT = "max-qty-limit";
|
||||
static final String RULE_ACTUAL_QTY_IS = "actual-quantity-is";
|
||||
|
||||
static final String RULE_KEY_FORCE_LIMITED = 'force_limited';
|
||||
static final String RULE_KEY_FIELD_KEY = 'field-key';
|
||||
|
||||
static dynamic getRule(Map<String, dynamic> json, String ruleName) {
|
||||
if (json != null && json.containsKey(rulesName)) {
|
||||
if ((json[rulesName] as Map).containsKey(ruleName)) {
|
||||
if (json[rulesName][ruleName] is bool) {
|
||||
return {ruleName: true};
|
||||
} else if (json[rulesName][ruleName] is int) {
|
||||
return {ruleName: json[rulesName][ruleName]};
|
||||
}
|
||||
return json[rulesName][ruleName];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user