TF-3410 Use TextTheme apply almost text style for text widget
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/keyboard_utils.dart';
|
||||
@@ -46,6 +45,7 @@ class ForwardController extends BaseController {
|
||||
final selectionMode = Rx<SelectMode>(SelectMode.INACTIVE);
|
||||
final listRecipientForward = RxList<RecipientForward>();
|
||||
final currentForward = Rxn<TMailForward>();
|
||||
final forwardWarningBannerState = Rxn<BannerState>();
|
||||
|
||||
bool get currentForwardLocalCopyState => currentForward.value?.localCopy ?? false;
|
||||
|
||||
@@ -122,20 +122,6 @@ class ForwardController extends BaseController {
|
||||
onConfirmAction: () => _handleDeleteRecipientAction({emailAddress}),
|
||||
showAsBottomSheet: true,
|
||||
useIconAsBasicLogo: true,
|
||||
actionStyle: const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.steelGray600,
|
||||
),
|
||||
cancelStyle: const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
actionButtonColor: AppColor.colorF3F6F9,
|
||||
cancelButtonColor: AppColor.blue700,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,20 +204,6 @@ class ForwardController extends BaseController {
|
||||
onConfirmAction: () => _handleDeleteRecipientAction(listEmailAddress),
|
||||
showAsBottomSheet: true,
|
||||
useIconAsBasicLogo: true,
|
||||
actionStyle: const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.steelGray600,
|
||||
),
|
||||
cancelStyle: const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
),
|
||||
actionButtonColor: AppColor.colorF3F6F9,
|
||||
cancelButtonColor: AppColor.blue700,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -333,9 +305,9 @@ class ForwardController extends BaseController {
|
||||
}
|
||||
|
||||
void _updateForwardWarningBannerState() {
|
||||
accountDashBoardController.forwardWarningBannerState.value = _isExistRecipientSameServerDomain
|
||||
forwardWarningBannerState.value = _isExistRecipientSameServerDomain
|
||||
? BannerState.enabled
|
||||
: BannerState.disabled;
|
||||
log('ForwardController::_updateForwardWarningBannerState: forwardWarningBannerState = ${accountDashBoardController.forwardWarningBannerState.value}');
|
||||
log('ForwardController::_updateForwardWarningBannerState: forwardWarningBannerState = ${forwardWarningBannerState.value}');
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,17 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.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/state/banner_state.dart';
|
||||
import 'package:tmail_ui_user/features/home/domain/extensions/session_extensions.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/base/setting_detail_view_builder.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/forward_header_widget.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/list_email_forward_widget.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/widgets/setting_explanation_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 {
|
||||
@@ -19,74 +24,76 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: SettingsUtils.getBackgroundColor(context, controller.responsiveUtils),
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: SettingsUtils.getContentBackgroundColor(context, controller.responsiveUtils),
|
||||
decoration: SettingsUtils.getBoxDecorationForContent(context, controller.responsiveUtils),
|
||||
margin: SettingsUtils.getMarginViewForForwardSettingDetails(context, controller.responsiveUtils),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (controller.responsiveUtils.isWebDesktop(context))
|
||||
...[
|
||||
ForwardHeaderWidget(imagePaths: controller.imagePaths, responsiveUtils: controller.responsiveUtils),
|
||||
const Divider(height: 1, color: AppColor.colorDividerHeaderSetting)
|
||||
return Column(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (controller.forwardWarningBannerState.value == BannerState.enabled) {
|
||||
return ForwardWarningBanner(
|
||||
imagePaths: controller.imagePaths,
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(
|
||||
child: SettingDetailViewBuilder(
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (controller.responsiveUtils.isWebDesktop(context))
|
||||
...[
|
||||
const SettingHeaderWidget(menuItem: AccountMenuItem.forward),
|
||||
const Divider(height: 1, color: AppColor.colorDividerHeaderSetting),
|
||||
],
|
||||
Expanded(child: SingleChildScrollView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
child: Padding(
|
||||
padding: SettingsUtils.getSettingContentPadding(
|
||||
context,
|
||||
controller.responsiveUtils,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (!controller.responsiveUtils.isWebDesktop(context))
|
||||
const SettingExplanationWidget(
|
||||
menuItem: AccountMenuItem.forward,
|
||||
padding: EdgeInsetsDirectional.only(bottom: 24),
|
||||
),
|
||||
_buildKeepLocalSwitchButton(context),
|
||||
Obx(() => controller.currentForward.value != null
|
||||
? _buildAddRecipientsFormWidget(context)
|
||||
: const SizedBox.shrink()
|
||||
),
|
||||
_buildLoadingView(),
|
||||
Obx(() {
|
||||
if (controller.listRecipientForward.isNotEmpty) {
|
||||
return const ListEmailForwardsWidget();
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
})
|
||||
],
|
||||
),
|
||||
)
|
||||
))
|
||||
],
|
||||
Expanded(child: SingleChildScrollView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
if (!controller.responsiveUtils.isWebDesktop(context))
|
||||
_buildTitleHeader(context),
|
||||
_buildKeepLocalSwitchButton(context),
|
||||
Obx(() => controller.currentForward.value != null
|
||||
? _buildAddRecipientsFormWidget(context)
|
||||
: const SizedBox.shrink()
|
||||
),
|
||||
_buildLoadingView(),
|
||||
Obx(() {
|
||||
if (controller.listRecipientForward.isNotEmpty) {
|
||||
return const ListEmailForwardsWidget();
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
})
|
||||
])
|
||||
))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTitleHeader(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
width: double.infinity,
|
||||
padding: SettingsUtils.getPaddingTitleHeaderForwarding(context, controller.responsiveUtils),
|
||||
child: Text(
|
||||
AppLocalizations.of(context).forwardingSettingExplanation,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.colorSettingExplanation
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildKeepLocalSwitchButton(BuildContext context) {
|
||||
return Obx(() {
|
||||
return controller.listRecipientForward.isNotEmpty
|
||||
? Container(
|
||||
color: Colors.transparent,
|
||||
padding: SettingsUtils.getPaddingKeepLocalSwitchButtonForwarding(context, controller.responsiveUtils),
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24, top: 8),
|
||||
child: Row(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: InkWell(
|
||||
InkWell(
|
||||
onTap: controller.handleEditLocalCopy,
|
||||
child: SvgPicture.asset(
|
||||
controller.currentForwardLocalCopyState
|
||||
@@ -94,19 +101,24 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
: controller.imagePaths.icSwitchOff,
|
||||
fit: BoxFit.fill,
|
||||
width: 36,
|
||||
height: 24))),
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).keepLocalCopyForwardLabel,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black)
|
||||
height: 24,
|
||||
),
|
||||
),
|
||||
)
|
||||
]))
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).keepLocalCopyForwardLabel,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox();
|
||||
});
|
||||
|
||||
@@ -116,9 +128,7 @@ class ForwardView extends GetWidget<ForwardController> with AppLoaderMixin {
|
||||
return Obx(() => controller.viewState.value.fold(
|
||||
(failure) => const SizedBox.shrink(),
|
||||
(success) => success is LoadingState
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: loadingWidget)
|
||||
? loadingWidget
|
||||
: const SizedBox.shrink()
|
||||
));
|
||||
}
|
||||
|
||||
+17
-39
@@ -22,7 +22,6 @@ import 'package:tmail_ui_user/features/contact/presentation/widgets/contact_inpu
|
||||
import 'package:tmail_ui_user/features/contact/presentation/widgets/contact_suggestion_box_item.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/utils/email_utils.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/exceptions/forward_exception.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||
@@ -179,28 +178,23 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
);
|
||||
|
||||
if (widget.hasAddContactButton == true) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
width: double.infinity,
|
||||
padding: SettingsUtils.getPaddingInputRecipientForwarding(context, _responsiveUtils),
|
||||
child: _responsiveUtils.isScreenWithShortestSide(context)
|
||||
? Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
itemTagEditor,
|
||||
const SizedBox(height: 16),
|
||||
_buildAddRecipientButton(context, maxWidth: double.infinity)
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: itemTagEditor),
|
||||
const SizedBox(width: 12),
|
||||
_buildAddRecipientButton(context)
|
||||
],
|
||||
)
|
||||
);
|
||||
return _responsiveUtils.isScreenWithShortestSide(context)
|
||||
? Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
itemTagEditor,
|
||||
const SizedBox(height: 16),
|
||||
_buildAddRecipientButton(context, maxWidth: double.infinity)
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Expanded(child: itemTagEditor),
|
||||
const SizedBox(width: 12),
|
||||
_buildAddRecipientButton(context)
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return itemTagEditor;
|
||||
}
|
||||
@@ -461,22 +455,6 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
||||
height: 40,
|
||||
colorFilter: AppColor.colorQuotaError.asFilter(),
|
||||
),
|
||||
messageStyle: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
fontSize: 17,
|
||||
color: Colors.black
|
||||
),
|
||||
titleStyle: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
fontSize: 14,
|
||||
color: AppColor.colorMessageConfirmDialog
|
||||
),
|
||||
actionStyle: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
fontSize: 17,
|
||||
color: Colors.white
|
||||
),
|
||||
cancelStyle: Theme.of(context).textTheme.labelMedium?.copyWith(
|
||||
fontSize: 17,
|
||||
color: Colors.black
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
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:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class ForwardHeaderWidget extends StatelessWidget {
|
||||
const ForwardHeaderWidget({
|
||||
Key? key,
|
||||
required this.imagePaths,
|
||||
required this.responsiveUtils,
|
||||
}) : super(key: key);
|
||||
|
||||
final ImagePaths imagePaths;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
padding: const EdgeInsets.only(top: 24, left: 24, right: 24, bottom: 11),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).forwarding,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black)),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
AppLocalizations.of(context).forwardingSettingExplanation,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.colorSettingExplanation)),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
+11
-5
@@ -1,21 +1,27 @@
|
||||
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:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
|
||||
class ForwardWarningBanner extends StatelessWidget {
|
||||
|
||||
final ImagePaths _imagePaths = Get.find<ImagePaths>();
|
||||
final ImagePaths imagePaths;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
|
||||
ForwardWarningBanner({super.key});
|
||||
const ForwardWarningBanner({
|
||||
super.key,
|
||||
required this.imagePaths,
|
||||
required this.responsiveUtils,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
|
||||
margin: SettingsUtils.getForwardBannerPadding(context, responsiveUtils),
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(8)),
|
||||
@@ -23,7 +29,7 @@ class ForwardWarningBanner extends StatelessWidget {
|
||||
),
|
||||
child: Row(children: [
|
||||
SvgPicture.asset(
|
||||
_imagePaths.icInfoCircleOutline,
|
||||
imagePaths.icInfoCircleOutline,
|
||||
colorFilter: AppColor.colorQuotaError.asFilter(),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
+29
-34
@@ -8,7 +8,6 @@ import 'package:model/mailbox/select_mode.dart';
|
||||
import 'package:tmail_ui_user/features/home/domain/extensions/session_extensions.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/email_forward_item_widget.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/recipient_forward.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
@@ -18,39 +17,35 @@ class ListEmailForwardsWidget extends GetWidget<ForwardController> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
padding: SettingsUtils.getPaddingListRecipientForwarding(context, controller.responsiveUtils),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTitleHeader(context),
|
||||
Obx(() {
|
||||
if (controller.listRecipientForward.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
itemCount: controller.listRecipientForward.length,
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (context, index) {
|
||||
return EmailForwardItemWidget(
|
||||
recipientForward: controller.listRecipientForward[index],
|
||||
internalDomain: controller.accountDashBoardController.sessionCurrent?.internalDomain ?? '',
|
||||
selectionMode: controller.selectionMode.value,
|
||||
onSelectRecipientCallback: controller.selectRecipientForward,
|
||||
onDeleteRecipientCallback: (recipientForward) {
|
||||
controller.deleteRecipients(context, recipientForward.emailAddress.emailAddress);
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}),
|
||||
]
|
||||
),
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTitleHeader(context),
|
||||
Obx(() {
|
||||
if (controller.listRecipientForward.isEmpty) {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
itemCount: controller.listRecipientForward.length,
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (context, index) {
|
||||
return EmailForwardItemWidget(
|
||||
recipientForward: controller.listRecipientForward[index],
|
||||
internalDomain: controller.accountDashBoardController.sessionCurrent?.internalDomain ?? '',
|
||||
selectionMode: controller.selectionMode.value,
|
||||
onSelectRecipientCallback: controller.selectRecipientForward,
|
||||
onDeleteRecipientCallback: (recipientForward) {
|
||||
controller.deleteRecipients(context, recipientForward.emailAddress.emailAddress);
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user