TF-2116 Add icon, color and base widget

(cherry picked from commit a4c7eea22ec6557bfdaee4d0ee18ce1a4501a43d)
This commit is contained in:
dab246
2023-09-06 11:40:08 +07:00
committed by Dat H. Pham
parent 305c08fea1
commit 2571022e5f
22 changed files with 128 additions and 69 deletions
+1
View File
@@ -83,6 +83,7 @@ export 'presentation/views/bottom_popup/full_screen_action_sheet_builder.dart';
export 'presentation/views/checkbox/labeled_checkbox.dart';
export 'presentation/views/container/tmail_container_widget.dart';
export 'presentation/views/clipper/side_arrow_clipper.dart';
export 'presentation/views/avatar/gradient_circle_avatar_icon.dart';
// Resources
export 'presentation/resources/assets_paths.dart';
@@ -207,6 +207,15 @@ extension AppColor on Color {
static const colorEmptyPopupDialogButton = Color(0xFFFFC107);
static const colorCancelPopupDialogButton = Color(0xFFEBEDF0);
static const colorRemoveRuleFilterConditionButton = Color(0xFFE6E8EC);
static const colorComposerShadowTop = Color(0x28000000);
static const colorComposerShadowBottom = Color(0x1E000000);
static const colorComposerAppBar = Color(0xFFF4F4F4);
static const colorLabelComposer = Color(0xFF8C9CAF);
static const colorLineComposer = Color(0xFFF4F4F4);
static const colorPrefixButtonComposer = Color(0xFFAEAAAE);
static const colorRichButtonComposer = Color(0xFFAEAEC0);
static const colorMobileRichButtonComposer = Color(0xFF8C9CAF);
static const colorSelected = Color(0xFFE3F1FF);
static const mapGradientColor = [
[Color(0xFF21D4FD), Color(0xFFB721FF)],
@@ -35,7 +35,7 @@ class ImagePaths {
String get icForward => _getImagePath('ic_forward.svg');
String get icMoveEmail => _getImagePath('ic_move_email.svg');
String get icUnreadEmail => _getImagePath('ic_unread_email.svg');
String get icCloseMailbox => _getImagePath('ic_close_mailbox.svg');
String get icCircleClose => _getImagePath('ic_circle_close.svg');
String get icAddNewFolder => _getImagePath('ic_add_new_folder.svg');
String get icFolderMailbox => _getImagePath('ic_folder_mailbox.svg');
String get icMailboxInbox => _getImagePath('ic_mailbox_inbox.svg');
@@ -55,9 +55,7 @@ class ImagePaths {
String get icRemoveDialog => _getImagePath('ic_remove_dialog.svg');
String get icNewMessage => _getImagePath('ic_new_message.svg');
String get icUnreadStatus => _getImagePath('ic_unread_status.svg');
String get icAttachmentsComposer => _getImagePath('ic_attachments_composer.svg');
String get icCloseComposer => _getImagePath('ic_close_composer.svg');
String get icFullScreenComposer => _getImagePath('ic_fullscreen_composer.svg');
String get icFullScreen => _getImagePath('ic_fullscreen.svg');
String get icMinimize => _getImagePath('ic_minimize.svg');
String get icDeleteComposer => _getImagePath('ic_delete_composer.svg');
String get icDeleteAttachment => _getImagePath('ic_delete_attachment.svg');
@@ -110,7 +108,6 @@ class ImagePaths {
String get icFilePdf => _getImagePath('ic_file_pdf.svg');
String get icFilePptx => _getImagePath('ic_file_pptx.svg');
String get icFileEPup => _getImagePath('ic_file_epup.svg');
String get icCloseAdvancedSearch => _getImagePath('ic_close_advanced_search.svg');
String get icLanguage => _getImagePath('ic_language.svg');
String get icChecked => _getImagePath('ic_checked.svg');
String get icStyleBold => _getImagePath('ic_style_bold.svg');
@@ -199,6 +196,12 @@ class ImagePaths {
String get icFormatQuote => _getImagePath('ic_format_quote.svg');
String get icTMailLogo => _getImagePath('ic_tmail_logo.svg');
String get icLoginGraphic => _getImagePath('ic_login_graphic.svg');
String get icCancel => _getImagePath('ic_cancel.svg');
String get icRichToolbar => _getImagePath('ic_rich_toolbar.svg');
String get icSaveToDraft => _getImagePath('ic_save_to_draft.svg');
String get icAttachmentFile => _getImagePath('ic_attachment_file.svg');
String get icAttachFile => _getImagePath('ic_attach_file.svg');
String get icSend => _getImagePath('ic_send.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
@@ -0,0 +1,46 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:flutter/material.dart';
class GradientCircleAvatarIcon extends StatelessWidget {
final List<Color> colors;
final double iconSize;
final double labelFontSize;
final String label;
const GradientCircleAvatarIcon({
Key? key,
required this.colors,
this.iconSize = 40,
this.label = '',
this.labelFontSize = 24.0,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: iconSize,
height: iconSize,
alignment: Alignment.center,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: const [0.0, 1.0],
colors: colors
),
color: AppColor.avatarColor
),
child: Text(
label,
style: TextStyle(
color: Colors.white,
fontSize: labelFontSize,
fontWeight: FontWeight.w600
)
)
);
}
}
@@ -33,6 +33,7 @@ class TMailButtonWidget extends StatelessWidget {
final TextAlign? textAlign;
final bool flexibleText;
final BoxBorder? border;
final TextDirection iconAlignment;
const TMailButtonWidget({
super.key,
@@ -61,6 +62,7 @@ class TMailButtonWidget extends StatelessWidget {
this.textAlign,
this.flexibleText = false,
this.border,
this.iconAlignment = TextDirection.ltr,
});
factory TMailButtonWidget.fromIcon({
@@ -190,20 +192,31 @@ class TMailButtonWidget extends StatelessWidget {
]
);
} else {
childWidget = Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
icon!,
width: iconSize,
height: iconSize,
fit: BoxFit.fill,
colorFilter: iconColor?.asFilter()
),
SizedBox(width: iconSpace),
if (flexibleText)
Flexible(
child: Text(
if (iconAlignment == TextDirection.ltr) {
childWidget = Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset(
icon!,
width: iconSize,
height: iconSize,
fit: BoxFit.fill,
colorFilter: iconColor?.asFilter()
),
SizedBox(width: iconSpace),
if (flexibleText)
Flexible(
child: Text(
text,
textAlign: textAlign,
style: textStyle ?? const TextStyle(
fontSize: 12,
color: AppColor.colorTextButtonHeaderThread
),
),
)
else
Text(
text,
textAlign: textAlign,
style: textStyle ?? const TextStyle(
@@ -211,29 +224,54 @@ class TMailButtonWidget extends StatelessWidget {
color: AppColor.colorTextButtonHeaderThread
),
),
)
else
Text(
text,
textAlign: textAlign,
style: textStyle ?? const TextStyle(
fontSize: 12,
color: AppColor.colorTextButtonHeaderThread
if (trailingIcon != null)
Padding(
padding: EdgeInsetsDirectional.only(start: iconSpace),
child: SvgPicture.asset(
trailingIcon!,
width: trailingIconSize,
height: trailingIconSize,
fit: BoxFit.fill,
colorFilter: trailingIconColor?.asFilter()
),
),
),
if (trailingIcon != null)
Padding(
padding: EdgeInsetsDirectional.only(start: iconSpace),
child: SvgPicture.asset(
trailingIcon!,
width: trailingIconSize,
height: trailingIconSize,
fit: BoxFit.fill,
colorFilter: trailingIconColor?.asFilter()
]
);
} else {
childWidget = Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (flexibleText)
Flexible(
child: Text(
text,
textAlign: textAlign,
style: textStyle ?? const TextStyle(
fontSize: 12,
color: AppColor.colorTextButtonHeaderThread
),
),
)
else
Text(
text,
textAlign: textAlign,
style: textStyle ?? const TextStyle(
fontSize: 12,
color: AppColor.colorTextButtonHeaderThread
),
),
SizedBox(width: iconSpace),
SvgPicture.asset(
icon!,
width: iconSize,
height: iconSize,
fit: BoxFit.fill,
colorFilter: iconColor?.asFilter()
),
]
);
]
);
}
}
} else if (icon != null) {
childWidget = SvgPicture.asset(
@@ -181,7 +181,7 @@ class ConfirmDialogBuilder {
child: Padding(
padding: const EdgeInsets.only(top: 8, right: 8),
child: buildIconWeb(
icon: SvgPicture.asset(_imagePath.icCloseMailbox, fit: BoxFit.fill),
icon: SvgPicture.asset(_imagePath.icCircleClose, fit: BoxFit.fill),
onTap: () => _onCloseButtonAction?.call())
)),
if (_iconWidget != null)