TF-3952 Change Keep a copy in Inbox switch button style
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
import 'package:core/presentation/state/success.dart';
|
import 'package:core/presentation/state/success.dart';
|
||||||
import 'package:core/presentation/utils/style_utils.dart';
|
|
||||||
import 'package:core/presentation/utils/theme_utils.dart';
|
import 'package:core/presentation/utils/theme_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
|
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
|
||||||
import 'package:tmail_ui_user/features/base/state/banner_state.dart';
|
import 'package:tmail_ui_user/features/base/state/banner_state.dart';
|
||||||
@@ -11,13 +9,13 @@ import 'package:tmail_ui_user/features/manage_account/presentation/base/setting_
|
|||||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_controller.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_controller.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/autocomplete_contact_text_field_with_tags.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/autocomplete_contact_text_field_with_tags.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/forward_warning_banner.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/forward_warning_banner.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/keep_copy_in_inbox_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/list_email_forward_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/list_email_forward_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/number_of_recipient_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/forward/widgets/number_of_recipient_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/widgets/setting_explanation_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/widgets/setting_explanation_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/manage_account/presentation/widgets/setting_header_widget.dart';
|
import 'package:tmail_ui_user/features/manage_account/presentation/widgets/setting_header_widget.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|
||||||
|
|
||||||
class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||||
|
|
||||||
@@ -85,7 +83,12 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildKeepLocalSwitchButton(context),
|
Obx(() => KeepCopyInInboxWidget(
|
||||||
|
imagePaths: controller.imagePaths,
|
||||||
|
recipientForwards: controller.listRecipientForward,
|
||||||
|
localCopyState: controller.currentForwardLocalCopyState,
|
||||||
|
onToggleLocalCopy: controller.handleEditLocalCopy,
|
||||||
|
)),
|
||||||
Obx(
|
Obx(
|
||||||
() => NumberOfRecipientWidget(
|
() => NumberOfRecipientWidget(
|
||||||
numberOfRecipient:
|
numberOfRecipient:
|
||||||
@@ -118,43 +121,6 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildKeepLocalSwitchButton(BuildContext context) {
|
|
||||||
return Obx(() {
|
|
||||||
return controller.listRecipientForward.isNotEmpty
|
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 24, top: 8),
|
|
||||||
child: Row(children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: controller.handleEditLocalCopy,
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
controller.currentForwardLocalCopyState
|
|
||||||
? controller.imagePaths.icSwitchOn
|
|
||||||
: controller.imagePaths.icSwitchOff,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
width: 36,
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 16),
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context).keepLocalCopyForwardLabel,
|
|
||||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
|
||||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
|
||||||
style: ThemeUtils.defaultTextStyleInterFont.copyWith(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: const SizedBox();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildLoadingView() {
|
Widget _buildLoadingView() {
|
||||||
return Obx(() => controller.viewState.value.fold(
|
return Obx(() => controller.viewState.value.fold(
|
||||||
(failure) => const SizedBox.shrink(),
|
(failure) => const SizedBox.shrink(),
|
||||||
|
|||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
import 'package:core/presentation/extensions/color_extension.dart';
|
||||||
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
|
import 'package:core/presentation/utils/theme_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:tmail_ui_user/features/manage_account/presentation/model/recipient_forward.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
class KeepCopyInInboxWidget extends StatelessWidget {
|
||||||
|
final ImagePaths imagePaths;
|
||||||
|
final List<RecipientForward> recipientForwards;
|
||||||
|
final bool localCopyState;
|
||||||
|
final VoidCallback onToggleLocalCopy;
|
||||||
|
|
||||||
|
const KeepCopyInInboxWidget({
|
||||||
|
super.key,
|
||||||
|
required this.imagePaths,
|
||||||
|
required this.recipientForwards,
|
||||||
|
required this.localCopyState,
|
||||||
|
required this.onToggleLocalCopy,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (recipientForwards.isEmpty) {
|
||||||
|
return const SizedBox.shrink();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 24),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 6),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: onToggleLocalCopy,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
localCopyState ? imagePaths.icSwitchOn : imagePaths.icSwitchOff,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
width: 52,
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).keepACopyInInbox,
|
||||||
|
style: ThemeUtils.textStyleBodyBody2(color: Colors.black),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context).keepACopyInInboxDescription,
|
||||||
|
style: ThemeUtils.textStyleBodyBody2(
|
||||||
|
color: AppColor.gray424244.withValues(alpha: 0.64),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2148,12 +2148,6 @@
|
|||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"keepLocalCopyForwardLabel": "Keep a copy of the email in Inbox",
|
|
||||||
"@keepLocalCopyForwardLabel": {
|
|
||||||
"type": "text",
|
|
||||||
"placeholders_order": [],
|
|
||||||
"placeholders": {}
|
|
||||||
},
|
|
||||||
"emailRuleSettingExplanation": "Creating rules to handle incoming messages. You choose both the condition that triggers a rule and the actions the rule will take.",
|
"emailRuleSettingExplanation": "Creating rules to handle incoming messages. You choose both the condition that triggers a rule and the actions the rule will take.",
|
||||||
"@emailRuleSettingExplanation": {
|
"@emailRuleSettingExplanation": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
@@ -4653,5 +4647,17 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders_order": [],
|
"placeholders_order": [],
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"keepACopyInInbox": "Keep a copy in Inbox",
|
||||||
|
"@keepACopyInInbox": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
|
},
|
||||||
|
"keepACopyInInboxDescription": "Store forwarded emails in your inbox as well as sending them to recipients",
|
||||||
|
"@keepACopyInInboxDescription": {
|
||||||
|
"type": "text",
|
||||||
|
"placeholders_order": [],
|
||||||
|
"placeholders": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2191,13 +2191,6 @@ class AppLocalizations {
|
|||||||
name: 'toastMessageLocalCopyDisable');
|
name: 'toastMessageLocalCopyDisable');
|
||||||
}
|
}
|
||||||
|
|
||||||
String get keepLocalCopyForwardLabel {
|
|
||||||
return Intl.message(
|
|
||||||
'Keep a copy of the email in Inbox',
|
|
||||||
name: 'keepLocalCopyForwardLabel',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String get emailRuleSettingExplanation {
|
String get emailRuleSettingExplanation {
|
||||||
return Intl.message(
|
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.',
|
'Creating rules to handle incoming messages. You choose both the condition that triggers a rule and the actions the rule will take.',
|
||||||
@@ -4905,4 +4898,18 @@ class AppLocalizations {
|
|||||||
name: 'ok',
|
name: 'ok',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get keepACopyInInbox {
|
||||||
|
return Intl.message(
|
||||||
|
'Keep a copy in Inbox',
|
||||||
|
name: 'keepACopyInInbox',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String get keepACopyInInboxDescription {
|
||||||
|
return Intl.message(
|
||||||
|
'Store forwarded emails in your inbox as well as sending them to recipients',
|
||||||
|
name: 'keepACopyInInboxDescription',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user