fix: font issue on linux.

dev
DebuggerX 3 years ago
parent 8a0fc5e196
commit 7da5790eb2

@ -18,11 +18,11 @@ var darkTheme = _darkTheme.copyWith(
textTheme: _darkTheme.textTheme.copyWith( textTheme: _darkTheme.textTheme.copyWith(
headline1: TextStyle( headline1: TextStyle(
color: Color(0xffc0c6d4), color: Color(0xffc0c6d4),
fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], fontFamily: kIsWeb ? null : defaultFontFamily,
), ),
bodyText2: TextStyle( bodyText2: TextStyle(
color: Color(0xffc0c6d4), color: Color(0xffc0c6d4),
fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], fontFamily: kIsWeb ? null : defaultFontFamily,
), ),
), ),
popupMenuTheme: _darkTheme.popupMenuTheme.copyWith( popupMenuTheme: _darkTheme.popupMenuTheme.copyWith(
@ -34,6 +34,7 @@ var darkTheme = _darkTheme.copyWith(
tooltipTheme: _darkTheme.tooltipTheme.copyWith( tooltipTheme: _darkTheme.tooltipTheme.copyWith(
textStyle: TextStyle( textStyle: TextStyle(
color: Colors.grey, color: Colors.grey,
fontFamily: kIsWeb ? null : defaultFontFamily,
), ),
padding: EdgeInsets.symmetric(horizontal: 3, vertical: 2), padding: EdgeInsets.symmetric(horizontal: 3, vertical: 2),
decoration: BoxDecoration( decoration: BoxDecoration(

@ -18,11 +18,11 @@ var lightTheme = _lightTheme.copyWith(
textTheme: _lightTheme.textTheme.copyWith( textTheme: _lightTheme.textTheme.copyWith(
headline1: TextStyle( headline1: TextStyle(
color: Color(0xff414d68), color: Color(0xff414d68),
fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], fontFamily: kIsWeb ? null : defaultFontFamily,
), ),
bodyText2: TextStyle( bodyText2: TextStyle(
color: Color(0xff414d68), color: Color(0xff414d68),
fontFamilyFallback: kIsWeb ? null : [defaultFontFamily], fontFamily: kIsWeb ? null : defaultFontFamily,
), ),
), ),
popupMenuTheme: _lightTheme.popupMenuTheme.copyWith( popupMenuTheme: _lightTheme.popupMenuTheme.copyWith(
@ -34,6 +34,7 @@ var lightTheme = _lightTheme.copyWith(
tooltipTheme: _lightTheme.tooltipTheme.copyWith( tooltipTheme: _lightTheme.tooltipTheme.copyWith(
textStyle: TextStyle( textStyle: TextStyle(
color: Colors.grey.shade600, color: Colors.grey.shade600,
fontFamily: kIsWeb ? null : defaultFontFamily,
), ),
padding: EdgeInsets.symmetric(horizontal: 3, vertical: 2), padding: EdgeInsets.symmetric(horizontal: 3, vertical: 2),
decoration: BoxDecoration( decoration: BoxDecoration(

@ -60,74 +60,72 @@ class _DMarkdownFieldState extends State<DMarkdownField> {
? context.watch<SettingsProvider>().activeColor ?? Color(0xff565656) ? context.watch<SettingsProvider>().activeColor ?? Color(0xff565656)
: Color(0xff565656)), : Color(0xff565656)),
), ),
child: DefaultTextStyle( child: isPreview
style: context.t.textTheme.bodyText2!, ? GestureDetector(
child: isPreview onTap: widget.readOnly
? GestureDetector( ? null
onTap: widget.readOnly : () {
? null setState(() {
: () { _previewText = null;
setState(() { });
_previewText = null;
});
},
child: MouseRegion(
cursor: widget.readOnly ? SystemMouseCursors.basic : SystemMouseCursors.text,
child: MdPreview(
text: _previewText ?? '',
padding: EdgeInsets.only(left: 15),
onTapLink: H.launchURL,
onCodeCopied: () {
Notificator.success(
context,
title: LocaleKeys.info_code_copied_titte.tr(),
description: LocaleKeys.info_code_copied_description.tr(),
);
}, },
widgetImage: (imageUrl) => CachedNetworkImage( child: MouseRegion(
imageUrl: imageUrl, cursor: widget.readOnly ? SystemMouseCursors.basic : SystemMouseCursors.text,
placeholder: (context, url) => const SizedBox( child: MdPreview(
width: double.infinity, text: _previewText ?? '',
height: 300, padding: EdgeInsets.only(left: 15),
child: Center(child: CircularProgressIndicator()), onTapLink: H.launchURL,
), textStyle: context.t.textTheme.bodyText2,
errorWidget: (context, url, error) => const Icon(Icons.error), onCodeCopied: () {
Notificator.success(
context,
title: LocaleKeys.info_code_copied_titte.tr(),
description: LocaleKeys.info_code_copied_description.tr(),
);
},
widgetImage: (imageUrl) => CachedNetworkImage(
imageUrl: imageUrl,
placeholder: (context, url) => const SizedBox(
width: double.infinity,
height: 300,
child: Center(child: CircularProgressIndicator()),
), ),
errorWidget: (context, url, error) => const Icon(Icons.error),
), ),
), ),
)
: MdEditor(
initText: widget.initText,
hintText: LocaleKeys.md_editor_init_text.tr(),
textFocusNode: _focusNode,
padding: EdgeInsets.symmetric(horizontal: 5),
onComplete: (content) {
if (content == widget.initText)
setState(() {
_previewText = content;
});
else
widget.onComplete(content);
},
actionMessages: {
ActionType.done: LocaleKeys.md_editor_done.tr(),
ActionType.undo: LocaleKeys.md_editor_undo.tr(),
ActionType.redo: LocaleKeys.md_editor_redo.tr(),
ActionType.image: LocaleKeys.md_editor_image.tr(),
ActionType.link: LocaleKeys.md_editor_link.tr(),
ActionType.fontBold: LocaleKeys.md_editor_font_bold.tr(),
ActionType.fontItalic: LocaleKeys.md_editor_font_italic.tr(),
ActionType.fontStrikethrough: LocaleKeys.md_editor_font_strikethrough.tr(),
ActionType.textQuote: LocaleKeys.md_editor_text_quote.tr(),
ActionType.list: LocaleKeys.md_editor_list.tr(),
ActionType.h1: LocaleKeys.md_editor_h1.tr(),
ActionType.h2: LocaleKeys.md_editor_h2.tr(),
ActionType.h3: LocaleKeys.md_editor_h3.tr(),
ActionType.h4: LocaleKeys.md_editor_h4.tr(),
ActionType.h5: LocaleKeys.md_editor_h5.tr(),
},
), ),
), )
: MdEditor(
initText: widget.initText,
hintText: LocaleKeys.md_editor_init_text.tr(),
textFocusNode: _focusNode,
padding: EdgeInsets.symmetric(horizontal: 5),
onComplete: (content) {
if (content == widget.initText)
setState(() {
_previewText = content;
});
else
widget.onComplete(content);
},
actionMessages: {
ActionType.done: LocaleKeys.md_editor_done.tr(),
ActionType.undo: LocaleKeys.md_editor_undo.tr(),
ActionType.redo: LocaleKeys.md_editor_redo.tr(),
ActionType.image: LocaleKeys.md_editor_image.tr(),
ActionType.link: LocaleKeys.md_editor_link.tr(),
ActionType.fontBold: LocaleKeys.md_editor_font_bold.tr(),
ActionType.fontItalic: LocaleKeys.md_editor_font_italic.tr(),
ActionType.fontStrikethrough: LocaleKeys.md_editor_font_strikethrough.tr(),
ActionType.textQuote: LocaleKeys.md_editor_text_quote.tr(),
ActionType.list: LocaleKeys.md_editor_list.tr(),
ActionType.h1: LocaleKeys.md_editor_h1.tr(),
ActionType.h2: LocaleKeys.md_editor_h2.tr(),
ActionType.h3: LocaleKeys.md_editor_h3.tr(),
ActionType.h4: LocaleKeys.md_editor_h4.tr(),
ActionType.h5: LocaleKeys.md_editor_h5.tr(),
},
),
); );
}), }),
); );

@ -237,22 +237,20 @@ class _MarketWidgetState extends State<MarketWidget> {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 8), padding: const EdgeInsets.only(left: 8),
child: DefaultTextStyle( child: MdPreview(
style: context.t.textTheme.bodyText2!, text: _schemes.firstWhereOrNull((e) => e.uuid == _selected)?.description ?? '',
child: MdPreview( widgetImage: (imageUrl) => CachedNetworkImage(
text: _schemes.firstWhereOrNull((e) => e.uuid == _selected)?.description ?? '', imageUrl: imageUrl,
widgetImage: (imageUrl) => CachedNetworkImage( placeholder: (context, url) => const SizedBox(
imageUrl: imageUrl, width: double.infinity,
placeholder: (context, url) => const SizedBox( height: 300,
width: double.infinity, child: Center(child: CircularProgressIndicator()),
height: 300,
child: Center(child: CircularProgressIndicator()),
),
errorWidget: (context, url, error) => const Icon(Icons.error),
), ),
onTapLink: H.launchURL, errorWidget: (context, url, error) => const Icon(Icons.error),
onCodeCopied: () {},
), ),
onTapLink: H.launchURL,
textStyle: context.t.textTheme.bodyText2,
onCodeCopied: () {},
), ),
), ),
), ),

@ -242,22 +242,20 @@ class _MeWidgetState extends State<MeWidget> {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 8), padding: const EdgeInsets.only(left: 8),
child: DefaultTextStyle( child: MdPreview(
style: context.t.textTheme.bodyText2!, text: _schemes.firstWhereOrNull((e) => e.uuid == _selected)?.description ?? '',
child: MdPreview( onTapLink: H.launchURL,
text: _schemes.firstWhereOrNull((e) => e.uuid == _selected)?.description ?? '', textStyle: context.t.textTheme.bodyText2,
onTapLink: H.launchURL, widgetImage: (imageUrl) => CachedNetworkImage(
widgetImage: (imageUrl) => CachedNetworkImage( imageUrl: imageUrl,
imageUrl: imageUrl, placeholder: (context, url) => const SizedBox(
placeholder: (context, url) => const SizedBox( width: double.infinity,
width: double.infinity, height: 300,
height: 300, child: Center(child: CircularProgressIndicator()),
child: Center(child: CircularProgressIndicator()),
),
errorWidget: (context, url, error) => const Icon(Icons.error),
), ),
onCodeCopied: () {}, errorWidget: (context, url, error) => const Icon(Icons.error),
), ),
onCodeCopied: () {},
), ),
), ),
), ),

Loading…
Cancel
Save