From 96b5be1518e9ff4ef7b7ae19663eb88e2d22af01 Mon Sep 17 00:00:00 2001 From: Xin Yao Date: Sat, 3 Apr 2021 00:54:25 -0700 Subject: [PATCH] Add style for leading --- lib/widgets/default_styles.dart | 5 +++++ lib/widgets/text_block.dart | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/widgets/default_styles.dart b/lib/widgets/default_styles.dart index 4f26d9d3..9490bebd 100644 --- a/lib/widgets/default_styles.dart +++ b/lib/widgets/default_styles.dart @@ -59,6 +59,7 @@ class DefaultStyles { final DefaultTextBlockStyle? code; final DefaultTextBlockStyle? indent; final DefaultTextBlockStyle? align; + final DefaultTextBlockStyle? leading; DefaultStyles( {this.h1, @@ -77,6 +78,7 @@ class DefaultStyles { this.code, this.indent, this.align, + this.leading, this.sizeSmall, this.sizeLarge, this.sizeHuge}); @@ -183,6 +185,8 @@ class DefaultStyles { baseStyle, baseSpacing, const Tuple2(0.0, 6.0), null), align: DefaultTextBlockStyle( baseStyle, const Tuple2(0.0, 0.0), const Tuple2(0.0, 0.0), null), + leading: DefaultTextBlockStyle( + baseStyle, const Tuple2(0.0, 0.0), const Tuple2(0.0, 0.0), null), sizeSmall: const TextStyle(fontSize: 10.0), sizeLarge: const TextStyle(fontSize: 18.0), sizeHuge: const TextStyle(fontSize: 22.0)); @@ -206,6 +210,7 @@ class DefaultStyles { code: other.code ?? code, indent: other.indent ?? indent, align: other.align ?? align, + leading: other.leading ?? leading, sizeSmall: other.sizeSmall ?? sizeSmall, sizeLarge: other.sizeLarge ?? sizeLarge, sizeHuge: other.sizeHuge ?? sizeHuge); diff --git a/lib/widgets/text_block.dart b/lib/widgets/text_block.dart index 7ea5b278..85912431 100644 --- a/lib/widgets/text_block.dart +++ b/lib/widgets/text_block.dart @@ -141,7 +141,7 @@ class EditableTextBlock extends StatelessWidget { index: index, indentLevelCounts: indentLevelCounts, count: count, - style: defaultStyles!.paragraph!.style, + style: defaultStyles!.leading!.style, attrs: attrs, width: 32.0, padding: 8.0, @@ -150,20 +150,20 @@ class EditableTextBlock extends StatelessWidget { if (attrs[Attribute.list.key] == Attribute.ul) { return _BulletPoint( - style: defaultStyles!.paragraph!.style - .copyWith(fontWeight: FontWeight.bold), + style: + defaultStyles!.leading!.style.copyWith(fontWeight: FontWeight.bold), width: 32, ); } if (attrs[Attribute.list.key] == Attribute.checked) { return _Checkbox( - style: defaultStyles!.paragraph!.style, width: 32, isChecked: true); + style: defaultStyles!.leading!.style, width: 32, isChecked: true); } if (attrs[Attribute.list.key] == Attribute.unchecked) { return _Checkbox( - style: defaultStyles!.paragraph!.style, width: 32, isChecked: false); + style: defaultStyles!.leading!.style, width: 32, isChecked: false); } if (attrs.containsKey(Attribute.codeBlock.key)) {