Skip to content

Commit

Permalink
fix: paragraph block backgroud color
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed May 22, 2023
1 parent ac17231 commit 6851f04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/editor/block_component/base_component/widget/nested_list_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

Expand Down Expand Up @@ -92,27 +91,26 @@ class _TextBlockComponentWidgetState extends State<TextBlockComponentWidget>
@override
Widget build(BuildContext context) {
return node.children.isEmpty
? buildBulletListBlockComponent(context)
: buildBulletListBlockComponentWithChildren(context);
? buildParagraphBlockComponent(context)
: buildParagraphBlockComponentWithChildren(context);
}

Widget buildBulletListBlockComponentWithChildren(BuildContext context) {
Widget buildParagraphBlockComponentWithChildren(BuildContext context) {
return Container(
color: backgroundColor.withOpacity(0.5),
color: backgroundColor,
child: NestedListWidget(
children: editorState.renderer.buildList(
context,
widget.node.children,
),
child: buildBulletListBlockComponent(context),
child: buildParagraphBlockComponent(context),
),
);
}

Widget buildBulletListBlockComponent(BuildContext context) {
Widget buildParagraphBlockComponent(BuildContext context) {
return Container(
color: node.children.isEmpty ? backgroundColor : null,
// padding: padding,
color: backgroundColor,
child: FlowyRichText(
key: forwardKey,
node: widget.node,
Expand Down
1 change: 1 addition & 0 deletions lib/src/editor_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class EditorState {
if (withUpdateSelection) {
_selectionUpdateReason = SelectionUpdateReason.transaction;
selection = transaction.afterSelection;
_selectionUpdateReason = SelectionUpdateReason.uiEvent;
// if the selection is not changed, we still need to notify the listeners.
selectionNotifier.notifyListeners();
}
Expand Down

0 comments on commit 6851f04

Please sign in to comment.