TF-2083 Add listRuleCondition
(cherry picked from commit dad160af2a1c7a90cf546413ead06c1b068a982b)
This commit is contained in:
+52
-19
@@ -4,6 +4,7 @@ import 'package:core/presentation/utils/app_toast.dart';
|
|||||||
import 'package:core/presentation/utils/keyboard_utils.dart';
|
import 'package:core/presentation/utils/keyboard_utils.dart';
|
||||||
import 'package:core/utils/app_logger.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
import 'package:core/utils/platform_info.dart';
|
import 'package:core/utils/platform_info.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
@@ -51,8 +52,6 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
final errorRuleName = Rxn<String>();
|
final errorRuleName = Rxn<String>();
|
||||||
final errorRuleConditionValue = Rxn<String>();
|
final errorRuleConditionValue = Rxn<String>();
|
||||||
final errorRuleActionValue = Rxn<String>();
|
final errorRuleActionValue = Rxn<String>();
|
||||||
final ruleConditionFieldSelected = Rxn<rule_condition.Field>();
|
|
||||||
final ruleConditionComparatorSelected = Rxn<rule_condition.Comparator>();
|
|
||||||
final emailRuleFilterActionSelected = Rxn<EmailRuleFilterAction>();
|
final emailRuleFilterActionSelected = Rxn<EmailRuleFilterAction>();
|
||||||
final mailboxSelected = Rxn<PresentationMailbox>();
|
final mailboxSelected = Rxn<PresentationMailbox>();
|
||||||
final actionType = CreatorActionType.create.obs;
|
final actionType = CreatorActionType.create.obs;
|
||||||
@@ -145,8 +144,6 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
void _setUpDefaultValueRuleFilter() {
|
void _setUpDefaultValueRuleFilter() {
|
||||||
switch(actionType.value) {
|
switch(actionType.value) {
|
||||||
case CreatorActionType.create:
|
case CreatorActionType.create:
|
||||||
ruleConditionFieldSelected.value = rule_condition.Field.from;
|
|
||||||
ruleConditionComparatorSelected.value = rule_condition.Comparator.contains;
|
|
||||||
RuleCondition newRuleCondition = RuleCondition(
|
RuleCondition newRuleCondition = RuleCondition(
|
||||||
field: rule_condition.Field.from,
|
field: rule_condition.Field.from,
|
||||||
comparator: rule_condition.Comparator.contains,
|
comparator: rule_condition.Comparator.contains,
|
||||||
@@ -164,8 +161,6 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
break;
|
break;
|
||||||
case CreatorActionType.edit:
|
case CreatorActionType.edit:
|
||||||
if (_currentTMailRule != null) {
|
if (_currentTMailRule != null) {
|
||||||
ruleConditionFieldSelected.value = _currentTMailRule!.condition.field;
|
|
||||||
ruleConditionComparatorSelected.value = _currentTMailRule!.condition.comparator;
|
|
||||||
RuleCondition currentRule = RuleCondition(
|
RuleCondition currentRule = RuleCondition(
|
||||||
field: _currentTMailRule!.condition.field,
|
field: _currentTMailRule!.condition.field,
|
||||||
comparator: _currentTMailRule!.condition.comparator,
|
comparator: _currentTMailRule!.condition.comparator,
|
||||||
@@ -228,12 +223,22 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void selectRuleConditionField(rule_condition.Field? newField, int? ruleConditionIndex) {
|
void selectRuleConditionField(rule_condition.Field? newField, int? ruleConditionIndex) {
|
||||||
listRuleCondition[ruleConditionIndex!].field.obs.value = newField!;
|
RuleCondition newRuleCondition = RuleCondition(
|
||||||
|
field: newField!,
|
||||||
|
comparator: listRuleCondition[ruleConditionIndex!].comparator.obs.value,
|
||||||
|
value: listRuleCondition[ruleConditionIndex].value.obs.value,
|
||||||
|
);
|
||||||
|
listRuleCondition[ruleConditionIndex] = newRuleCondition;
|
||||||
listRuleCondition.refresh();
|
listRuleCondition.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectRuleConditionComparator(rule_condition.Comparator? newComparator, int? ruleConditionIndex) {
|
void selectRuleConditionComparator(rule_condition.Comparator? newComparator, int? ruleConditionIndex) {
|
||||||
listRuleCondition[ruleConditionIndex!].comparator.obs.value = newComparator!;
|
RuleCondition newRuleCondition = RuleCondition(
|
||||||
|
field: listRuleCondition[ruleConditionIndex!].field.obs.value,
|
||||||
|
comparator: newComparator!,
|
||||||
|
value: listRuleCondition[ruleConditionIndex].value.obs.value,
|
||||||
|
);
|
||||||
|
listRuleCondition[ruleConditionIndex] = newRuleCondition;
|
||||||
listRuleCondition.refresh();
|
listRuleCondition.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,9 +294,7 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ruleConditionFieldSelected.value == null ||
|
if (listRuleCondition.isEmpty || emailRuleFilterActionSelected.value == null) {
|
||||||
ruleConditionComparatorSelected.value == null ||
|
|
||||||
emailRuleFilterActionSelected.value == null) {
|
|
||||||
if (currentOverlayContext != null && currentContext != null) {
|
if (currentOverlayContext != null && currentContext != null) {
|
||||||
_appToast.showToastErrorMessage(
|
_appToast.showToastErrorMessage(
|
||||||
currentOverlayContext!,
|
currentOverlayContext!,
|
||||||
@@ -300,7 +303,11 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final newTMailRule = TMailRule(
|
late EquatableMixin ruleFilterRequest;
|
||||||
|
|
||||||
|
if (actionType.value == CreatorActionType.create) {
|
||||||
|
for (var ruleCondition in listRuleCondition) {
|
||||||
|
final newTMailRule = TMailRule(
|
||||||
id: _currentTMailRule?.id,
|
id: _currentTMailRule?.id,
|
||||||
name: _newRuleName!,
|
name: _newRuleName!,
|
||||||
action: RuleAction(
|
action: RuleAction(
|
||||||
@@ -309,15 +316,28 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
condition: rule_condition.RuleCondition(
|
condition: rule_condition.RuleCondition(
|
||||||
field: ruleConditionFieldSelected.value!,
|
field: ruleCondition.field,
|
||||||
comparator: ruleConditionComparatorSelected.value!,
|
comparator: ruleCondition.comparator,
|
||||||
value: _newRuleConditionValue!
|
value: _newRuleConditionValue!
|
||||||
));
|
));
|
||||||
|
ruleFilterRequest = CreateNewEmailRuleFilterRequest(_listEmailRule ?? [], newTMailRule);
|
||||||
final ruleFilterRequest =
|
}
|
||||||
actionType.value == CreatorActionType.create
|
} else {
|
||||||
? CreateNewEmailRuleFilterRequest(_listEmailRule ?? [], newTMailRule)
|
final newTMailRule = TMailRule(
|
||||||
: EditEmailRuleFilterRequest(_listEmailRule?.withIds ?? [], newTMailRule);
|
id: _currentTMailRule?.id,
|
||||||
|
name: _newRuleName!,
|
||||||
|
action: RuleAction(
|
||||||
|
appendIn: RuleAppendIn(
|
||||||
|
mailboxIds: [mailboxSelected.value!.id]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
condition: rule_condition.RuleCondition(
|
||||||
|
field: listRuleCondition[0].field,
|
||||||
|
comparator: listRuleCondition[0].comparator,
|
||||||
|
value: _newRuleConditionValue!
|
||||||
|
));
|
||||||
|
ruleFilterRequest = EditEmailRuleFilterRequest(_listEmailRule?.withIds ?? [], newTMailRule);
|
||||||
|
}
|
||||||
popBack(result: ruleFilterRequest);
|
popBack(result: ruleFilterRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,4 +345,17 @@ class RulesFilterCreatorController extends BaseMailboxController {
|
|||||||
KeyboardUtils.hideKeyboard(context);
|
KeyboardUtils.hideKeyboard(context);
|
||||||
popBack();
|
popBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tapAddCondition() {
|
||||||
|
RuleCondition newRuleCondition = RuleCondition(
|
||||||
|
field: rule_condition.Field.from,
|
||||||
|
comparator: rule_condition.Comparator.contains,
|
||||||
|
value: ''
|
||||||
|
);
|
||||||
|
listRuleCondition.add(newRuleCondition);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tapRemoveCondition(int ruleConditionIndex) {
|
||||||
|
listRuleCondition.removeAt(ruleConditionIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -147,42 +147,8 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
|||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.black)),
|
color: Colors.black)),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
// Container(
|
|
||||||
// padding: const EdgeInsets.all(12),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: AppColor.colorBackgroundFieldConditionRulesFilter,
|
|
||||||
// borderRadius: BorderRadius.circular(12)),
|
|
||||||
// child: Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Expanded(child: Obx(() => DropDownButtonWidget<rule_condition.Field>(
|
|
||||||
// items: rule_condition.Field.values,
|
|
||||||
// itemSelected: controller.ruleConditionFieldSelected.value,
|
|
||||||
// dropdownMaxHeight: 250,
|
|
||||||
// onChanged: (newField) =>
|
|
||||||
// controller.selectRuleConditionField(newField),
|
|
||||||
// supportSelectionIcon: true))),
|
|
||||||
// Container(
|
|
||||||
// width: 220,
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
// child: Obx(() => DropDownButtonWidget<rule_condition.Comparator>(
|
|
||||||
// items: rule_condition.Comparator.values,
|
|
||||||
// itemSelected: controller.ruleConditionComparatorSelected.value,
|
|
||||||
// onChanged: (newComparator) =>
|
|
||||||
// controller.selectRuleConditionComparator(newComparator),
|
|
||||||
// supportSelectionIcon: true))),
|
|
||||||
// Expanded(child: Obx(() => RulesFilterInputField(
|
|
||||||
// hintText: AppLocalizations.of(context).conditionValueHintTextInput,
|
|
||||||
// errorText: controller.errorRuleConditionValue.value,
|
|
||||||
// editingController: controller.inputConditionValueController,
|
|
||||||
// focusNode: controller.inputRuleConditionFocusNode,
|
|
||||||
// onChangeAction: (value) =>
|
|
||||||
// controller.updateConditionValue(context, value))))
|
|
||||||
// ]
|
|
||||||
// )
|
|
||||||
// ),
|
|
||||||
Obx(() {
|
Obx(() {
|
||||||
return ListView.builder(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: controller.listRuleCondition.length,
|
itemCount: controller.listRuleCondition.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
@@ -199,10 +165,39 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
|||||||
controller.selectRuleConditionComparator(value, index),
|
controller.selectRuleConditionComparator(value, index),
|
||||||
conditionValueOnChangeAction: (value) =>
|
conditionValueOnChangeAction: (value) =>
|
||||||
controller.updateConditionValue(context, value),
|
controller.updateConditionValue(context, value),
|
||||||
|
tapRemoveRuleFilterConditionCallback: () => controller.tapRemoveCondition(index),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const SizedBox(height: 12,);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 8),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: controller.tapAddCondition,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
_imagePaths.icAddNewFolder,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15,),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).addCondition,
|
||||||
|
maxLines: 1,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 17,
|
||||||
|
color: AppColor.primaryColor
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
Text(AppLocalizations.of(context).actionTitleRulesFilter,
|
Text(AppLocalizations.of(context).actionTitleRulesFilter,
|
||||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
@@ -328,42 +323,8 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
|||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.black)),
|
color: Colors.black)),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
// Container(
|
|
||||||
// padding: const EdgeInsets.all(12),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: AppColor.colorBackgroundFieldConditionRulesFilter,
|
|
||||||
// borderRadius: BorderRadius.circular(12)),
|
|
||||||
// child: Row(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Expanded(child: Obx(() => DropDownButtonWidget<rule_condition.Field>(
|
|
||||||
// items: rule_condition.Field.values,
|
|
||||||
// itemSelected: controller.ruleConditionFieldSelected.value,
|
|
||||||
// dropdownMaxHeight: 250,
|
|
||||||
// onChanged: (newField) =>
|
|
||||||
// controller.selectRuleConditionField(newField),
|
|
||||||
// supportSelectionIcon: true))),
|
|
||||||
// Container(
|
|
||||||
// width: 220,
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
// child: Obx(() => DropDownButtonWidget<rule_condition.Comparator>(
|
|
||||||
// items: rule_condition.Comparator.values,
|
|
||||||
// itemSelected: controller.ruleConditionComparatorSelected.value,
|
|
||||||
// onChanged: (newComparator) =>
|
|
||||||
// controller.selectRuleConditionComparator(newComparator),
|
|
||||||
// supportSelectionIcon: true))),
|
|
||||||
// Expanded(child: Obx(() => RulesFilterInputField(
|
|
||||||
// hintText: AppLocalizations.of(context).conditionValueHintTextInput,
|
|
||||||
// errorText: controller.errorRuleConditionValue.value,
|
|
||||||
// editingController: controller.inputConditionValueController,
|
|
||||||
// focusNode: controller.inputRuleConditionFocusNode,
|
|
||||||
// onChangeAction: (value) =>
|
|
||||||
// controller.updateConditionValue(context, value))))
|
|
||||||
// ]
|
|
||||||
// )
|
|
||||||
// ),
|
|
||||||
Obx(() {
|
Obx(() {
|
||||||
return ListView.builder(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: controller.listRuleCondition.length,
|
itemCount: controller.listRuleCondition.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
@@ -380,10 +341,39 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
|||||||
controller.selectRuleConditionComparator(value, index),
|
controller.selectRuleConditionComparator(value, index),
|
||||||
conditionValueOnChangeAction: (value) =>
|
conditionValueOnChangeAction: (value) =>
|
||||||
controller.updateConditionValue(context, value),
|
controller.updateConditionValue(context, value),
|
||||||
|
tapRemoveRuleFilterConditionCallback: () => controller.tapRemoveCondition(index),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const SizedBox(height: 12,);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 8),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: controller.tapAddCondition,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
_imagePaths.icAddNewFolder,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15,),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).addCondition,
|
||||||
|
maxLines: 1,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 17,
|
||||||
|
color: AppColor.primaryColor
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
Text(AppLocalizations.of(context).actionTitleRulesFilter,
|
Text(AppLocalizations.of(context).actionTitleRulesFilter,
|
||||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
@@ -515,55 +505,8 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
|||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.black)),
|
color: Colors.black)),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
// Container(
|
|
||||||
// padding: const EdgeInsets.all(12),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: AppColor.colorBackgroundFieldConditionRulesFilter,
|
|
||||||
// borderRadius: BorderRadius.circular(12)),
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// Obx(() {
|
|
||||||
// return RuleFilterButtonField<rule_condition.Field>(
|
|
||||||
// value: controller.ruleConditionFieldSelected.value,
|
|
||||||
// tapActionCallback: (value) {
|
|
||||||
// KeyboardUtils.hideKeyboard(context);
|
|
||||||
// controller.openContextMenuAction(
|
|
||||||
// context,
|
|
||||||
// _bottomSheetRuleConditionFieldActionTiles(
|
|
||||||
// context,
|
|
||||||
// controller.ruleConditionFieldSelected.value));
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(vertical: 12),
|
|
||||||
// child: Obx(() {
|
|
||||||
// return RuleFilterButtonField<rule_condition.Comparator>(
|
|
||||||
// value: controller.ruleConditionComparatorSelected.value,
|
|
||||||
// tapActionCallback: (value) {
|
|
||||||
// KeyboardUtils.hideKeyboard(context);
|
|
||||||
// controller.openContextMenuAction(
|
|
||||||
// context,
|
|
||||||
// _bottomSheetRuleConditionComparatorActionTiles(
|
|
||||||
// context,
|
|
||||||
// controller.ruleConditionComparatorSelected.value));
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
// ),
|
|
||||||
// Obx(() => RulesFilterInputField(
|
|
||||||
// hintText: AppLocalizations.of(context).conditionValueHintTextInput,
|
|
||||||
// errorText: controller.errorRuleConditionValue.value,
|
|
||||||
// editingController: controller.inputConditionValueController,
|
|
||||||
// focusNode: controller.inputRuleConditionFocusNode,
|
|
||||||
// onChangeAction: (value) =>
|
|
||||||
// controller.updateConditionValue(context, value)))
|
|
||||||
// ]
|
|
||||||
// )
|
|
||||||
// ),
|
|
||||||
Obx(() {
|
Obx(() {
|
||||||
return ListView.builder(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: controller.listRuleCondition.length,
|
itemCount: controller.listRuleCondition.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
@@ -574,16 +517,58 @@ class RuleFilterCreatorView extends GetWidget<RulesFilterCreatorController> {
|
|||||||
conditionValueErrorText: controller.errorRuleConditionValue.value,
|
conditionValueErrorText: controller.errorRuleConditionValue.value,
|
||||||
conditionValueFocusNode: controller.inputRuleConditionFocusNode,
|
conditionValueFocusNode: controller.inputRuleConditionFocusNode,
|
||||||
conditionValueEditingController: controller.inputConditionValueController,
|
conditionValueEditingController: controller.inputConditionValueController,
|
||||||
tapRuleConditionFieldCallback: (value) =>
|
tapRuleConditionFieldCallback: (value) => controller.openContextMenuAction(
|
||||||
controller.selectRuleConditionField(value, index),
|
context,
|
||||||
tapRuleConditionComparatorCallback: (value) =>
|
_bottomSheetRuleConditionFieldActionTiles(
|
||||||
controller.selectRuleConditionComparator(value, index),
|
context,
|
||||||
|
controller.listRuleCondition[index].field.obs.value,
|
||||||
|
index,
|
||||||
|
)
|
||||||
|
),
|
||||||
|
tapRuleConditionComparatorCallback: (value) => controller.openContextMenuAction(
|
||||||
|
context,
|
||||||
|
_bottomSheetRuleConditionComparatorActionTiles(
|
||||||
|
context,
|
||||||
|
controller.listRuleCondition[index].comparator.obs.value,
|
||||||
|
index,
|
||||||
|
)
|
||||||
|
),
|
||||||
conditionValueOnChangeAction: (value) =>
|
conditionValueOnChangeAction: (value) =>
|
||||||
controller.updateConditionValue(context, value),
|
controller.updateConditionValue(context, value),
|
||||||
|
tapRemoveRuleFilterConditionCallback: () => controller.tapRemoveCondition(index),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return const SizedBox(height: 12,);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.only(top: 12),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: controller.tapAddCondition,
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
_imagePaths.icAddNewFolder,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15,),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).addCondition,
|
||||||
|
maxLines: 1,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
fontSize: 17,
|
||||||
|
color: AppColor.primaryColor
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 12),
|
padding: EdgeInsets.symmetric(vertical: 12),
|
||||||
child: Divider(
|
child: Divider(
|
||||||
|
|||||||
+9
-8
@@ -22,7 +22,7 @@ class RuleFilterConditionWidget extends StatelessWidget {
|
|||||||
final FocusNode? conditionValueFocusNode;
|
final FocusNode? conditionValueFocusNode;
|
||||||
final OnChangeFilterInputAction? conditionValueOnChangeAction;
|
final OnChangeFilterInputAction? conditionValueOnChangeAction;
|
||||||
final ImagePaths? imagePaths;
|
final ImagePaths? imagePaths;
|
||||||
final Function()? onTapRemoveRuleFilterConditionCallback;
|
final Function()? tapRemoveRuleFilterConditionCallback;
|
||||||
|
|
||||||
const RuleFilterConditionWidget({
|
const RuleFilterConditionWidget({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -35,7 +35,7 @@ class RuleFilterConditionWidget extends StatelessWidget {
|
|||||||
this.conditionValueFocusNode,
|
this.conditionValueFocusNode,
|
||||||
this.conditionValueOnChangeAction,
|
this.conditionValueOnChangeAction,
|
||||||
this.imagePaths,
|
this.imagePaths,
|
||||||
this.onTapRemoveRuleFilterConditionCallback,
|
this.tapRemoveRuleFilterConditionCallback,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -56,7 +56,7 @@ class RuleFilterConditionWidget extends StatelessWidget {
|
|||||||
conditionValueEditingController,
|
conditionValueEditingController,
|
||||||
conditionValueFocusNode,
|
conditionValueFocusNode,
|
||||||
conditionValueOnChangeAction,
|
conditionValueOnChangeAction,
|
||||||
onTapRemoveRuleFilterConditionCallback,
|
tapRemoveRuleFilterConditionCallback,
|
||||||
imagePaths,
|
imagePaths,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -74,7 +74,7 @@ Widget _buildRuleFilterCondition(
|
|||||||
TextEditingController? conditionValueEditingController,
|
TextEditingController? conditionValueEditingController,
|
||||||
FocusNode? conditionValueFocusNode,
|
FocusNode? conditionValueFocusNode,
|
||||||
OnChangeFilterInputAction? conditionValueOnChangeAction,
|
OnChangeFilterInputAction? conditionValueOnChangeAction,
|
||||||
Function()? onTapRemoveRuleFilterConditionCallback,
|
Function()? tapRemoveRuleFilterConditionCallback,
|
||||||
ImagePaths? imagePaths,
|
ImagePaths? imagePaths,
|
||||||
) {
|
) {
|
||||||
switch (ruleFilterConditionType) {
|
switch (ruleFilterConditionType) {
|
||||||
@@ -111,7 +111,7 @@ Widget _buildRuleFilterCondition(
|
|||||||
case RuleFilterConditionType.tablet:
|
case RuleFilterConditionType.tablet:
|
||||||
case RuleFilterConditionType.desktop:
|
case RuleFilterConditionType.desktop:
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: DropDownButtonWidget<rule_condition.Field>(
|
child: DropDownButtonWidget<rule_condition.Field>(
|
||||||
@@ -145,7 +145,7 @@ Widget _buildRuleFilterCondition(
|
|||||||
editingController: conditionValueEditingController,
|
editingController: conditionValueEditingController,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
_buildRemoveRuleFilterConditionButton(onTapRemoveRuleFilterConditionCallback, imagePaths),
|
_buildRemoveRuleFilterConditionButton(tapRemoveRuleFilterConditionCallback, imagePaths),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
@@ -154,13 +154,14 @@ Widget _buildRuleFilterCondition(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRemoveRuleFilterConditionButton (
|
Widget _buildRemoveRuleFilterConditionButton (
|
||||||
Function()? onTapRemoveRuleFilterConditionCallback,
|
Function()? tapRemoveRuleFilterConditionCallback,
|
||||||
ImagePaths? imagePath,
|
ImagePaths? imagePath,
|
||||||
) {
|
) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.only(left: 12),
|
padding: const EdgeInsets.only(left: 12),
|
||||||
|
alignment: Alignment.center,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTapRemoveRuleFilterConditionCallback,
|
onTap: tapRemoveRuleFilterConditionCallback,
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
backgroundColor: AppColor.colorRemoveRuleFilterConditionButton,
|
backgroundColor: AppColor.colorRemoveRuleFilterConditionButton,
|
||||||
radius: 22,
|
radius: 22,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"@@last_modified": "2023-08-30T16:14:12.029258",
|
"@@last_modified": "2023-08-31T14:39:56.761446",
|
||||||
"initializing_data": "Initializing data...",
|
"initializing_data": "Initializing data...",
|
||||||
"@initializing_data": {
|
"@initializing_data": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -3211,5 +3211,11 @@
|
|||||||
"placeholders": {
|
"placeholders": {
|
||||||
"folder": {}
|
"folder": {}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"addCondition": "Add condition",
|
||||||
|
"@addCondition": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3310,4 +3310,11 @@ class AppLocalizations {
|
|||||||
args: [folder]
|
args: [folder]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get addCondition {
|
||||||
|
return Intl.message(
|
||||||
|
'Add condition',
|
||||||
|
name: 'addCondition',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user