fix: font issue in md editor and preview; builtin command selector issue.

dev
DebuggerX 3 years ago
parent f7dfffd7a3
commit 8a0fc5e196

@ -605,13 +605,11 @@ Widget _buildCommandCellsEditing(BuildContext context) {
('${LocaleKeys.built_in_commands}.$e').tr(), ('${LocaleKeys.built_in_commands}.$e').tr(),
textScaleFactor: .8, textScaleFactor: .8,
), ),
value: ('${LocaleKeys.built_in_commands}.$e').tr(), value: e,
), ),
) )
.toList(), .toList(),
value: value: (builtInCommands.contains(gesture.command) ? gesture.command : builtInCommands.first)!,
('${LocaleKeys.built_in_commands}.${(builtInCommands.contains(gesture.command) ? gesture.command : builtInCommands.first)!}')
.tr(),
onChanged: (value) => context.read<GesturePropProvider>().setProps( onChanged: (value) => context.read<GesturePropProvider>().setProps(
command: value, command: value,
editMode: true, editMode: true,

@ -60,71 +60,74 @@ class _DMarkdownFieldState extends State<DMarkdownField> {
? context.watch<SettingsProvider>().activeColor ?? Color(0xff565656) ? context.watch<SettingsProvider>().activeColor ?? Color(0xff565656)
: Color(0xff565656)), : Color(0xff565656)),
), ),
child: isPreview child: DefaultTextStyle(
? GestureDetector( style: context.t.textTheme.bodyText2!,
onTap: widget.readOnly child: isPreview
? null ? GestureDetector(
: () { onTap: widget.readOnly
setState(() { ? null
_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(),
);
}, },
child: MouseRegion( widgetImage: (imageUrl) => CachedNetworkImage(
cursor: widget.readOnly ? SystemMouseCursors.basic : SystemMouseCursors.text, imageUrl: imageUrl,
child: MdPreview( placeholder: (context, url) => const SizedBox(
text: _previewText ?? '', width: double.infinity,
padding: EdgeInsets.only(left: 15), height: 300,
onTapLink: H.launchURL, child: Center(child: CircularProgressIndicator()),
onCodeCopied: () { ),
Notificator.success( errorWidget: (context, url, error) => const Icon(Icons.error),
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,19 +237,22 @@ class _MarketWidgetState extends State<MarketWidget> {
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 8), padding: const EdgeInsets.only(left: 8),
child: MdPreview( child: DefaultTextStyle(
text: _schemes.firstWhereOrNull((e) => e.uuid == _selected)?.description ?? '', style: context.t.textTheme.bodyText2!,
widgetImage: (imageUrl) => CachedNetworkImage( child: MdPreview(
imageUrl: imageUrl, text: _schemes.firstWhereOrNull((e) => e.uuid == _selected)?.description ?? '',
placeholder: (context, url) => const SizedBox( widgetImage: (imageUrl) => CachedNetworkImage(
width: double.infinity, imageUrl: imageUrl,
height: 300, placeholder: (context, url) => const SizedBox(
child: Center(child: CircularProgressIndicator()), width: double.infinity,
height: 300,
child: Center(child: CircularProgressIndicator()),
),
errorWidget: (context, url, error) => const Icon(Icons.error),
), ),
errorWidget: (context, url, error) => const Icon(Icons.error), onTapLink: H.launchURL,
onCodeCopied: () {},
), ),
onTapLink: H.launchURL,
onCodeCopied: () {},
), ),
), ),
), ),

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

Loading…
Cancel
Save