add view list rule
This commit is contained in:
@@ -145,6 +145,10 @@ class ImagePaths {
|
||||
String get icAlignOutdent => _getImagePath('ic_align_outdent.svg');
|
||||
String get icOrderNumber => _getImagePath('ic_order_number.svg');
|
||||
String get icOrderBullet => _getImagePath('ic_order_bullet.svg');
|
||||
String get icEmailRules => _getImagePath('ic_email_rules.svg');
|
||||
String get icAddNewRules => _getImagePath('ic_add_new_rule.svg');
|
||||
String get icEditRule => _getImagePath('ic_edit_rule.svg');
|
||||
String get icDeleteRule => _getImagePath('ic_delete_rule.svg');
|
||||
|
||||
String _getImagePath(String imageName) {
|
||||
return AssetsPaths.images + imageName;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
SERVER_URL=http://localhost
|
||||
SERVER_URL=https://gateway.upn.integration-open-paas.org
|
||||
DOMAIN_REDIRECT_URL=http://localhost:3000
|
||||
WEB_OIDC_CLIENT_ID=teammail-web
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rule_filter/rule_filter/tmail_rule.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
|
||||
class EmailRulesController extends BaseController {
|
||||
|
||||
final listEmailRule = <TMailRule>[].obs;
|
||||
|
||||
EmailRulesController();
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onDone() {
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(error) {}
|
||||
|
||||
void goToCreateNewRule() {
|
||||
//TODO: goToCreateNewRule
|
||||
}
|
||||
|
||||
void editEmailRule(TMailRule rule){
|
||||
//TODO: editEmailRule
|
||||
}
|
||||
|
||||
void deleteEmailRule(TMailRule rule){
|
||||
//TODO: deleteEmailRule
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/widgets/email_rules_header_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/widgets/list_email_rules_widget.dart';
|
||||
|
||||
class EmailRulesView extends GetWidget<EmailRulesController> {
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
EmailRulesView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: _responsiveUtils.isWebDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
margin: _responsiveUtils.isWebDesktop(context)
|
||||
? const EdgeInsets.only(left: 48, right: 24, top: 24, bottom: 24)
|
||||
: EdgeInsets.zero,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
_responsiveUtils.isWebDesktop(context) ? 20 : 0),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: _responsiveUtils.isWebDesktop(context) ? 24 : 10,
|
||||
top: 24,
|
||||
right: 24),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
EmailRulesHeaderWidget(
|
||||
imagePaths: _imagePaths,
|
||||
responsiveUtils: _responsiveUtils,
|
||||
createRule: () {
|
||||
//TODO: createRule
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 22),
|
||||
const Expanded(child: ListEmailRulesWidget())
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rule_filter/rule_filter/tmail_rule.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_controller.dart';
|
||||
|
||||
class EmailRulesItemWidget extends GetWidget<EmailRulesController> {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
EmailRulesItemWidget({
|
||||
Key? key,
|
||||
required this.editRule,
|
||||
required this.rule,
|
||||
required this.deleteRule,
|
||||
}) : super(key: key);
|
||||
|
||||
final void Function(TMailRule) editRule;
|
||||
final TMailRule rule;
|
||||
final void Function(TMailRule) deleteRule;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 24),
|
||||
color: Colors.white,
|
||||
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(rule.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black)),
|
||||
const Spacer(),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
_imagePaths.icEditRule,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
onTap: () {
|
||||
editRule.call(rule);
|
||||
}),
|
||||
buildIconWeb(
|
||||
icon: SvgPicture.asset(
|
||||
_imagePaths.icDeleteAttachment,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
onTap: () {
|
||||
deleteRule.call(rule);
|
||||
}),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/button_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_controller.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class EmailRulesHeaderWidget extends GetWidget<EmailRulesController> {
|
||||
const EmailRulesHeaderWidget({
|
||||
Key? key,
|
||||
required this.createRule,
|
||||
required this.imagePaths,
|
||||
required this.responsiveUtils,
|
||||
}) : super(key: key);
|
||||
|
||||
final VoidCallback createRule;
|
||||
final ImagePaths imagePaths;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final buttonAddNewRule = Row(children: [
|
||||
if (!responsiveUtils.isMobile(context))
|
||||
(ButtonBuilder(imagePaths.icAddNewRules)
|
||||
..key(const Key('button_new_rule'))
|
||||
..decoration(BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: AppColor.colorTextButton))
|
||||
..paddingIcon(const EdgeInsets.only(right: 8))
|
||||
..iconColor(Colors.white)
|
||||
..maxWidth(170)
|
||||
..size(20)
|
||||
..radiusSplash(10)
|
||||
..padding(const EdgeInsets.symmetric(vertical: 12))
|
||||
..textStyle(const TextStyle(
|
||||
fontSize: 17,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500,
|
||||
))
|
||||
..onPressActionClick(() => controller.goToCreateNewRule())
|
||||
..text(
|
||||
AppLocalizations.of(context).addNewRule,
|
||||
isVertical: false,
|
||||
))
|
||||
.build()
|
||||
]);
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.colorBackgroundWrapIconStyleCode,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(AppLocalizations.of(context).emailRules,
|
||||
style: const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black)),
|
||||
const SizedBox(height: 4),
|
||||
Text(AppLocalizations.of(context).emailRulesSubtitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorTextButtonHeaderThread)),
|
||||
const SizedBox(height: 24),
|
||||
buttonAddNewRule,
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+32
-22
@@ -1,23 +1,12 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/button/button_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/widgets/email_rule_item_widget.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class EmailRulesHeaderWidget extends GetWidget<EmailRulesController> {
|
||||
const EmailRulesHeaderWidget({
|
||||
Key? key,
|
||||
required this.createRule,
|
||||
required this.imagePaths,
|
||||
required this.responsiveUtils,
|
||||
}) : super(key: key);
|
||||
|
||||
final Function() createRule;
|
||||
final ImagePaths imagePaths;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
class ListEmailRulesWidget extends GetWidget<EmailRulesController> {
|
||||
const ListEmailRulesWidget({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -38,14 +27,35 @@ class EmailRulesHeaderWidget extends GetWidget<EmailRulesController> {
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.colorTextButtonHeaderThread)),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(AppLocalizations.of(context).emailRulesSubtitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorTextButtonHeaderThread)),
|
||||
const SizedBox(height: 24),
|
||||
buttonAddNewRule,
|
||||
const Divider(
|
||||
color: AppColor.lineItemListColor,
|
||||
height: 1,
|
||||
thickness: 0.2,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemCount: controller.listEmailRule.length,
|
||||
itemBuilder: (context, index) {
|
||||
final rule = controller.listEmailRule[index];
|
||||
return EmailRulesItemWidget(
|
||||
rule: rule,
|
||||
editRule: (rule) {
|
||||
controller.editEmailRule(rule);
|
||||
},
|
||||
deleteRule: (rule) {
|
||||
controller.editEmailRule(rule);
|
||||
},
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) =>
|
||||
const Divider(
|
||||
color: AppColor.lineItemListColor,
|
||||
height: 1,
|
||||
thickness: 0.2,
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/language_and_region_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_view.dart';
|
||||
@@ -146,6 +147,8 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
||||
return ProfilesView();
|
||||
case AccountMenuItem.languageAndRegion:
|
||||
return LanguageAndRegionView();
|
||||
case AccountMenuItem.emailRules:
|
||||
return EmailRulesView();
|
||||
default:
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class ManageAccountMenuController extends BaseController {
|
||||
|
||||
final listAccountMenuItem = <AccountMenuItem>[
|
||||
AccountMenuItem.profiles,
|
||||
AccountMenuItem.emailRules,
|
||||
AccountMenuItem.languageAndRegion,
|
||||
];
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
enum AccountMenuItem {
|
||||
profiles,
|
||||
languageAndRegion
|
||||
languageAndRegion,
|
||||
emailRules,
|
||||
}
|
||||
|
||||
extension AccountMenuItemExtension on AccountMenuItem {
|
||||
@@ -16,6 +17,8 @@ extension AccountMenuItemExtension on AccountMenuItem {
|
||||
return imagePaths.icProfiles;
|
||||
case AccountMenuItem.languageAndRegion:
|
||||
return imagePaths.icLanguage;
|
||||
case AccountMenuItem.emailRules:
|
||||
return imagePaths.icEmailRules;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +28,8 @@ extension AccountMenuItemExtension on AccountMenuItem {
|
||||
return AppLocalizations.of(context).profiles;
|
||||
case AccountMenuItem.languageAndRegion:
|
||||
return AppLocalizations.of(context).languageAndRegion;
|
||||
case AccountMenuItem.emailRules:
|
||||
return AppLocalizations.of(context).emailRules;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"@@last_modified": "2022-08-04T11:25:19.254781",
|
||||
"@@last_modified": "2022-08-08T08:50:15.957543",
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -1753,5 +1753,29 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"emailRules": "Email Rules",
|
||||
"@emailRules": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"emailRulesSubtitle": "Creating rules to handle incoming messages. You choose both the condition that triggers a rule and the actions the rule will take.",
|
||||
"@emailRulesSubtitle": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"addNewRule": "Add rule",
|
||||
"@addNewRule": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"headerNameOfRules": "Name of Rules",
|
||||
"@headerNameOfRules": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -1798,4 +1798,32 @@ class AppLocalizations {
|
||||
name: 'moveTo',
|
||||
);
|
||||
}
|
||||
|
||||
String get emailRules {
|
||||
return Intl.message(
|
||||
'Email Rules',
|
||||
name: 'emailRules',
|
||||
);
|
||||
}
|
||||
|
||||
String get emailRulesSubtitle {
|
||||
return Intl.message(
|
||||
'Creating rules to handle incoming messages. You choose both the condition that triggers a rule and the actions the rule will take.',
|
||||
name: 'emailRulesSubtitle',
|
||||
);
|
||||
}
|
||||
|
||||
String get addNewRule {
|
||||
return Intl.message(
|
||||
'Add rule',
|
||||
name: 'addNewRule',
|
||||
);
|
||||
}
|
||||
|
||||
String get headerNameOfRules {
|
||||
return Intl.message(
|
||||
'Name of Rules',
|
||||
name: 'headerNameOfRules',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,9 @@ dependencies:
|
||||
contact:
|
||||
path: contact
|
||||
|
||||
rule_filter:
|
||||
path: rule_filter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.2
|
||||
|
||||
Reference in New Issue
Block a user