import 'package:core/presentation/constants/constants_ui.dart';
import 'package:flutter/material.dart';
class HtmlTemplate {
static const String printDocumentCssStyle = '''
''';
/// HTML content is rendered outside Flutter, so the font can only be reached
/// by URL and the design system asset path has to be spelled out here. Keep
/// it aligned with the family resolved by `ThemeUtils`.
///
/// Relative (no leading `/`) so it resolves against `` on web,
/// including non-root preview deploys. On mobile this alone is not enough:
/// `InAppWebView.loadData()` has no base URL by default (resolves against
/// `about:blank`), so a relative path still 404s there. Fixing that needs
/// wiring a base URL into `HtmlContentViewer` / `IosHtmlContentViewerWidget`
/// (`WebViewAssetLoader` on Android, `allowingReadAccessTo` on iOS) — not
/// done yet, tracked as a follow-up.
static const String _fontAssetDirectory =
'assets/packages/linagora_design_flutter/assets/fonts';
static const String fontFamilyApp = ConstantsUI.fontApp;
static const String fontFaceStyle = '''
@font-face {
font-family: '$fontFamilyApp';
src: url("$_fontAssetDirectory/${ConstantsUI.fontFileRegular}.ttf") format("truetype");
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: '$fontFamilyApp';
src: url("$_fontAssetDirectory/${ConstantsUI.fontFileMedium}.ttf") format("truetype");
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: '$fontFamilyApp';
src: url("$_fontAssetDirectory/${ConstantsUI.fontFileSemiBold}.ttf") format("truetype");
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: '$fontFamilyApp';
src: url("$_fontAssetDirectory/${ConstantsUI.fontFileBold}.ttf") format("truetype");
font-weight: 700;
font-style: normal;
}
body {
font-family: '$fontFamilyApp', sans-serif;
}
''';
static String defaultFontStyle({double fontSize = 14}) => '''
body {
font-weight: 400;
font-size: ${fontSize}px;
font-style: normal;
}
p {
margin: 0px;
}
''';
static const String defaultEditorFontStyle = '''
#editor, .note-editable, .note-frame {
font-size: 16px;
color: #222222;
}
p {
margin: 0px;
}
''';
static const String previewEMLFileCssStyle = '''
''';
static const String markDownAndASCIIArtStyleCSS = 'display: block; font-family: monospace; white-space: pre; margin: 1em 0px;';
static String webCustomInternalStyleCSS({
bool useDefaultFontStyle = false,
bool customScrollbar = false,
}) => '''
''';
static String mobileCustomInternalStyleCSS({
bool useDefaultFontStyle = false,
TextDirection direction = TextDirection.ltr,
}) => '''
${HtmlTemplate.fontFaceStyle}
${useDefaultFontStyle ? HtmlTemplate.defaultEditorFontStyle : ''}
#editor {
direction: ${direction.name};
}
#editor .tmail-signature {
text-align: ${direction == TextDirection.rtl ? 'right' : 'left'};
}
''';
static const String disableScrollingStyleCSS = '''
html, body {
overflow: hidden;
overscroll-behavior: none;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE/Edge */
}
::-webkit-scrollbar {
display: none;
}
''';
}