From d13f55754be8dedfd0724d7705b7987313c5557c Mon Sep 17 00:00:00 2001 From: Alan Mantoux Date: Tue, 30 Apr 2024 22:34:03 +0200 Subject: [PATCH 1/2] List numbers should follow the theme and align according to line height --- .../fleather/lib/src/widgets/editable_text_block.dart | 9 +++++++-- packages/fleather/lib/src/widgets/editor.dart | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/fleather/lib/src/widgets/editable_text_block.dart b/packages/fleather/lib/src/widgets/editable_text_block.dart index 1d80ebae..accf0947 100644 --- a/packages/fleather/lib/src/widgets/editable_text_block.dart +++ b/packages/fleather/lib/src/widgets/editable_text_block.dart @@ -163,7 +163,7 @@ class EditableTextBlock extends StatelessWidget { leadingWidgets.add(_NumberPoint( number: currentIndex + 1, - style: theme.paragraph.style, + style: theme.lists.style, width: 32.0, padding: 8.0, )); @@ -318,8 +318,13 @@ class _NumberPoint extends StatelessWidget { @override Widget build(BuildContext context) { + final styleHeight = style.height; return Container( - alignment: AlignmentDirectional.topEnd, + // Empirically, depending on height of the style, we need to + // align at top or at bottom + alignment: styleHeight == null || styleHeight <= 1 + ? AlignmentDirectional.topEnd + : AlignmentDirectional.bottomEnd, width: width, padding: EdgeInsetsDirectional.only(end: padding), child: Text(withDot ? '$number.' : '$number', style: style), diff --git a/packages/fleather/lib/src/widgets/editor.dart b/packages/fleather/lib/src/widgets/editor.dart index 40e7dc64..0219ba44 100644 --- a/packages/fleather/lib/src/widgets/editor.dart +++ b/packages/fleather/lib/src/widgets/editor.dart @@ -13,8 +13,8 @@ import 'package:parchment_delta/parchment_delta.dart'; import '../../util.dart'; import '../rendering/editor.dart'; -import '../services/spell_check_suggestions_toolbar.dart'; import '../services/clipboard_manager.dart'; +import '../services/spell_check_suggestions_toolbar.dart'; import 'baseline_proxy.dart'; import 'controller.dart'; import 'cursor.dart'; From 350547d62ecb3a371271061d352eac1db49f46aa Mon Sep 17 00:00:00 2001 From: Alan Mantoux Date: Sun, 5 May 2024 13:35:55 +0200 Subject: [PATCH 2/2] Restoring alignment --- packages/fleather/lib/src/widgets/editable_text_block.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/fleather/lib/src/widgets/editable_text_block.dart b/packages/fleather/lib/src/widgets/editable_text_block.dart index accf0947..a4bb4f04 100644 --- a/packages/fleather/lib/src/widgets/editable_text_block.dart +++ b/packages/fleather/lib/src/widgets/editable_text_block.dart @@ -318,13 +318,10 @@ class _NumberPoint extends StatelessWidget { @override Widget build(BuildContext context) { - final styleHeight = style.height; return Container( // Empirically, depending on height of the style, we need to // align at top or at bottom - alignment: styleHeight == null || styleHeight <= 1 - ? AlignmentDirectional.topEnd - : AlignmentDirectional.bottomEnd, + alignment: AlignmentDirectional.topEnd, width: width, padding: EdgeInsetsDirectional.only(end: padding), child: Text(withDot ? '$number.' : '$number', style: style),