TF-4093 Make interface more compact

This commit is contained in:
dab246
2025-10-16 10:00:41 +07:00
committed by Dat H. Pham
parent 804f5e2a02
commit 7d80557582
23 changed files with 373 additions and 272 deletions
@@ -93,7 +93,6 @@ extension AppColor on Color {
static const colorDividerEmailView = Color(0xFFD7D8D9);
static const colorButton = Color(0xFF959DAD);
static const colorTime = Color(0xFF92A1B4);
static const colorEmailAddressPrefix = Color(0xFF9AA7B6);
static const colorEmailAddressTag = Color(0xFFF4F4F4);
static const colorLineLeftEmailView = Color(0x2999A2AD);
static const colorShadowComposer = Color(0x1F000000);
@@ -258,6 +257,7 @@ extension AppColor on Color {
static const gray424244 = Color(0xFF424244);
static const lightGrayF4F4F4 = Color(0xFFF4F4F4);
static const gray959DAD = Color(0xFF959DAD);
static const gray9AA7B6 = Color(0xFF9AA7B6);
static const redFF3347 = Color(0xFFFF3347);
static const gray686E76 = Color(0xFF686E76);
static const lightGrayEBEDF0 = Color(0xFFEBEDF0);
@@ -142,6 +142,14 @@ class ThemeUtils {
backgroundColor: backgroundColor,
);
static TextStyle textStyleBodySmallHeadline = defaultTextStyleInterFont.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: -0.13,
fontSize: 13,
height: 16 / 13,
color: Colors.black,
);
static TextStyle textStyleHeadingH6({
Color? color,
FontWeight? fontWeight,
@@ -23,6 +23,7 @@ class HtmlContentViewerOnWeb extends StatefulWidget {
final TextDirection? direction;
final double? contentPadding;
final bool useDefaultFontStyle;
final double fontSize;
/// Handler for mailto: links
final OnMailtoClicked? mailtoDelegate;
@@ -60,6 +61,7 @@ class HtmlContentViewerOnWeb extends StatefulWidget {
this.keepAlive = false,
this.disableScrolling = false,
this.autoAdjustHeight = false,
this.fontSize = 14,
this.htmlContentMinHeight = ConstantsUI.htmlContentMinHeight,
this.htmlContentMinWidth = ConstantsUI.htmlContentMinWidth,
this.offsetHtmlContentHeight = ConstantsUI.htmlContentOffsetHeight,
@@ -406,6 +408,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb>
direction: widget.direction,
contentPadding: widget.contentPadding,
useDefaultFontStyle: widget.useDefaultFontStyle,
fontSize: widget.fontSize,
);
return htmlTemplate;
@@ -30,6 +30,7 @@ class HtmlContentViewer extends StatefulWidget {
final bool keepWidthWhileLoading;
final double? contentPadding;
final bool useDefaultFontStyle;
final double fontSize;
final double? maxHtmlContentHeight;
final double htmlContentMinHeight;
final double offsetHtmlContentHeight;
@@ -58,6 +59,7 @@ class HtmlContentViewer extends StatefulWidget {
this.contentPadding,
this.useDefaultFontStyle = false,
this.disableScrolling = false,
this.fontSize = 16,
this.maxViewHeight,
this.maxHtmlContentHeight,
this.onLoadWidthHtmlViewer,
@@ -151,6 +153,7 @@ class HtmlContentViewState extends State<HtmlContentViewer> with AutomaticKeepAl
styleCSS: combinedCss,
contentPadding: widget.contentPadding,
useDefaultFontStyle: widget.useDefaultFontStyle,
fontSize: widget.fontSize,
);
}
@@ -54,6 +54,7 @@ class _IosHtmlContentViewerWidgetState extends State<IosHtmlContentViewerWidget>
direction: widget.direction,
javaScripts: HtmlInteraction.scriptsHandleLazyLoadingBackgroundImage,
useDefaultFontStyle: widget.useDefaultFontStyle,
fontSize: 16,
));
}
@@ -18,6 +18,7 @@ class AvatarBuilder {
List<Color>? _avatarColors;
List<BoxShadow>? _boxShadows;
TextStyle? _textStyle;
EdgeInsetsGeometry? _padding;
void key(Key key) {
_key = key;
@@ -55,6 +56,10 @@ class AvatarBuilder {
_textStyle = textStyle;
}
void addPadding(EdgeInsetsGeometry? padding) {
_padding = padding;
}
void addOnTapActionClick(OnTapAvatarActionClick onTapAvatarActionClick) {
_onTapAvatarActionClick = onTapAvatarActionClick;
}
@@ -64,7 +69,7 @@ class AvatarBuilder {
}
Widget build() {
return InkWell(
final bodyWidget = InkWell(
onTap: _onTapAvatarActionClick,
onTapDown: (detail) {
if (_onTapAvatarActionWithPositionClick != null && _context != null) {
@@ -102,5 +107,11 @@ class AvatarBuilder {
)
),
);
if (_padding != null) {
return Padding(padding: _padding!, child: bodyWidget);
} else {
return bodyWidget;
}
}
}
+4 -5
View File
@@ -103,12 +103,11 @@ class HtmlTemplate {
}
''';
static const String defaultFontStyle = '''
div, p, span, th, td, tr, ul, ol, li, a, button {
static String defaultFontStyle({double fontSize = 14}) => '''
body {
font-weight: 400;
font-size: 16px;
line-height: 24px;
letter-spacing: -0.01em; /* -1% */
font-size: ${fontSize}px;
font-style: normal;
}
p {
+2 -1
View File
@@ -123,6 +123,7 @@ class HtmlUtils {
String? javaScripts,
bool hideScrollBar = true,
bool useDefaultFontStyle = false,
double fontSize = 14,
TextDirection? direction,
double? contentPadding,
}) {
@@ -135,7 +136,7 @@ class HtmlUtils {
<style>
${HtmlTemplate.fontFaceStyle}
${useDefaultFontStyle ? HtmlTemplate.defaultFontStyle : ''}
${useDefaultFontStyle ? HtmlTemplate.defaultFontStyle(fontSize: fontSize) : ''}
.tmail-content {
min-height: ${minHeight ?? 0}px;