Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
feat: support dark mode for number-list and bulleted-list
Lucas.Xu3fb997af8406
diff --git a/frontend/app_flowy/lib/plugins/doc/editor_styles.dart b/frontend/app_flowy/lib/plugins/doc/editor_styles.dartindex dc472aeaf1..09437ff36d 100644--- a/frontend/app_flowy/lib/plugins/doc/editor_styles.dart+++ b/frontend/app_flowy/lib/plugins/doc/editor_styles.dart@@ -55,7 +55,25 @@ EditorStyle customEditorStyle(BuildContext context) {headingToPadding[node.attributes.heading] ?? basePadding;return EdgeInsets.only(bottom: padding);},- )+ ),+ 'text/number-list': builtInPluginStyle+ ..addAll(+ {+ 'numberColor': (EditorState editorState, Node node) {+ final theme = context.watch<AppTheme>();+ return theme.isDark ? Colors.white : Colors.black;+ },+ },+ ),+ 'text/bulleted-list': builtInPluginStyle+ ..addAll(+ {+ 'bulletColor': (EditorState editorState, Node node) {+ final theme = context.watch<AppTheme>();+ return theme.isDark ? Colors.white : Colors.black;+ },+ },+ ),},);}diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/bulleted_list_text.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/bulleted_list_text.dartindex 36e3568684..5fbac22824 100644--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/bulleted_list_text.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/bulleted_list_text.dart@@ -64,6 +64,18 @@ class _BulletedListTextNodeWidgetState extends State<BulletedListTextNodeWidget>return super.baseOffset.translate(0, padding.top);}+ Color get bulletColor {+ final bulletColor = widget.editorState.editorStyle.style(+ widget.editorState,+ widget.textNode,+ 'bulletColor',+ );+ if (bulletColor is Color) {+ return bulletColor;+ }+ return Colors.black;+ }+@overrideWidget buildWithSingle(BuildContext context) {return Padding(@@ -76,6 +88,7 @@ class _BulletedListTextNodeWidgetState extends State<BulletedListTextNodeWidget>width: iconSize?.width,height: iconSize?.height,padding: iconPadding,+ color: bulletColor,name: 'point',),Flexible(diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/number_list_text.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/number_list_text.dartindex 6ce4bd0fee..6d8004028b 100644--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/number_list_text.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/rich_text/number_list_text.dart@@ -58,6 +58,18 @@ class _NumberListTextNodeWidgetState extends State<NumberListTextNodeWidget>return super.baseOffset.translate(0, padding.top);}+ Color get numberColor {+ final numberColor = widget.editorState.editorStyle.style(+ widget.editorState,+ widget.textNode,+ 'numberColor',+ );+ if (numberColor is Color) {+ return numberColor;+ }+ return Colors.black;+ }+@overrideWidget build(BuildContext context) {return Padding(@@ -70,8 +82,11 @@ class _NumberListTextNodeWidgetState extends State<NumberListTextNodeWidget>padding: iconPadding,child: Text('${widget.textNode.attributes.number.toString()}.',- // FIXME: customize- style: const TextStyle(fontSize: 16.0, color: Colors.black),+ style: TextStyle(+ fontSize: widget.editorState.editorStyle.textStyle+ .defaultTextStyle.fontSize,+ color: numberColor,+ ),),),Flexible(diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/style/editor_style.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/style/editor_style.dartindex a8cc9eb638..331ec1d1af 100644--- a/frontend/app_flowy/packages/appflowy_editor/lib/src/render/style/editor_style.dart+++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/render/style/editor_style.dart@@ -117,12 +117,20 @@ Map<String, PluginStyle> builtInTextStylers = {),'text/bulleted-list': builtInPluginStyle,'text/number-list': builtInPluginStyle- ..update(- 'iconPadding',- (_) => (EditorState editorState, Node node) {+ ..addAll({+ 'numberColor': (EditorState editorState, Node node) {+ return Colors.black;+ },+ 'iconPadding': (EditorState editorState, Node node) {return const EdgeInsets.only(left: 5.0, right: 5.0);},- ),+ }),+ 'text/bulleted-list': builtInPluginStyle+ ..addAll({+ 'bulletColor': (EditorState editorState, Node node) {+ return Colors.black;+ },+ }),'text/quote': builtInPluginStyle,'image': builtInPluginStyle,};