From e4c3a3ae84bc83a00d31ad5cde300fd99e1b17c9 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Fri, 29 Jul 2022 10:38:02 +0800 Subject: [PATCH] feat: modify svg size --- .../lib/render/rich_text/bulleted_list_text.dart | 5 +++-- .../lib/render/rich_text/checkbox_text.dart | 15 ++++----------- .../lib/render/rich_text/number_list_text.dart | 1 + .../lib/render/rich_text/quoted_text.dart | 3 ++- .../flowy_editor/lib/service/input_service.dart | 2 +- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/bulleted_list_text.dart b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/bulleted_list_text.dart index faf1cb8c56..a345f7de3f 100644 --- a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/bulleted_list_text.dart +++ b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/bulleted_list_text.dart @@ -43,7 +43,7 @@ class BulletedListTextNodeWidget extends StatefulWidget { class _BulletedListTextNodeWidgetState extends State with Selectable, DefaultSelectable { - final _richTextKey = GlobalKey(debugLabel: 'heading_text'); + final _richTextKey = GlobalKey(debugLabel: 'bulleted_list_text'); final leftPadding = 20.0; @override @@ -59,7 +59,8 @@ class _BulletedListTextNodeWidgetState extends State Widget build(BuildContext context) { return Row( children: [ - const FlowySvg( + FlowySvg( + size: Size.square(leftPadding), name: 'point', ), FlowyRichText( diff --git a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/checkbox_text.dart b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/checkbox_text.dart index 11f1c9bba1..cdadcfe08c 100644 --- a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/checkbox_text.dart +++ b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/checkbox_text.dart @@ -44,24 +44,17 @@ class CheckboxNodeWidget extends StatefulWidget { class _CheckboxNodeWidgetState extends State with Selectable, DefaultSelectable { - final _checkboxKey = GlobalKey(debugLabel: 'checkbox'); final _richTextKey = GlobalKey(debugLabel: 'checkbox_text'); + final leftPadding = 20.0; + @override Selectable get forward => _richTextKey.currentState as Selectable; @override Offset get baseOffset { - final width = _checkboxKey.currentContext - ?.findRenderObject() - ?.unwrapOrNull() - ?.size - .width; - if (width != null) { - return Offset(width, 0); - } - return Offset.zero; + return Offset(leftPadding, 0); } @override @@ -80,7 +73,7 @@ class _CheckboxNodeWidgetState extends State children: [ GestureDetector( child: FlowySvg( - key: _checkboxKey, + size: Size.square(leftPadding), name: check ? 'check' : 'uncheck', ), onTap: () { diff --git a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/number_list_text.dart b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/number_list_text.dart index 368272f2d2..288199f797 100644 --- a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/number_list_text.dart +++ b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/number_list_text.dart @@ -61,6 +61,7 @@ class _NumberListTextNodeWidgetState extends State return Row( children: [ FlowySvg( + size: Size.square(leftPadding), number: widget.textNode.attributes.number, ), FlowyRichText( diff --git a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/quoted_text.dart b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/quoted_text.dart index b4ee999ce8..8d0c919d7b 100644 --- a/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/quoted_text.dart +++ b/frontend/app_flowy/packages/flowy_editor/lib/render/rich_text/quoted_text.dart @@ -58,7 +58,8 @@ class _QuotedTextNodeWidgetState extends State Widget build(BuildContext context) { return Row( children: [ - const FlowySvg( + FlowySvg( + size: Size.square(leftPadding), name: 'quote', ), FlowyRichText( diff --git a/frontend/app_flowy/packages/flowy_editor/lib/service/input_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/service/input_service.dart index bdbcd24467..38309414f4 100644 --- a/frontend/app_flowy/packages/flowy_editor/lib/service/input_service.dart +++ b/frontend/app_flowy/packages/flowy_editor/lib/service/input_service.dart @@ -90,7 +90,7 @@ class _FlowyInputState extends State @override void apply(List deltas) { -// TODO: implement the detail + // TODO: implement the detail for (final delta in deltas) { if (delta is TextEditingDeltaInsertion) { } else if (delta is TextEditingDeltaDeletion) {