Add style for leading

pull/135/head
Xin Yao 4 years ago
parent 2f550d5e85
commit 96b5be1518
  1. 5
      lib/widgets/default_styles.dart
  2. 10
      lib/widgets/text_block.dart

@ -59,6 +59,7 @@ class DefaultStyles {
final DefaultTextBlockStyle? code; final DefaultTextBlockStyle? code;
final DefaultTextBlockStyle? indent; final DefaultTextBlockStyle? indent;
final DefaultTextBlockStyle? align; final DefaultTextBlockStyle? align;
final DefaultTextBlockStyle? leading;
DefaultStyles( DefaultStyles(
{this.h1, {this.h1,
@ -77,6 +78,7 @@ class DefaultStyles {
this.code, this.code,
this.indent, this.indent,
this.align, this.align,
this.leading,
this.sizeSmall, this.sizeSmall,
this.sizeLarge, this.sizeLarge,
this.sizeHuge}); this.sizeHuge});
@ -183,6 +185,8 @@ class DefaultStyles {
baseStyle, baseSpacing, const Tuple2(0.0, 6.0), null), baseStyle, baseSpacing, const Tuple2(0.0, 6.0), null),
align: DefaultTextBlockStyle( align: DefaultTextBlockStyle(
baseStyle, const Tuple2(0.0, 0.0), const Tuple2(0.0, 0.0), null), 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), sizeSmall: const TextStyle(fontSize: 10.0),
sizeLarge: const TextStyle(fontSize: 18.0), sizeLarge: const TextStyle(fontSize: 18.0),
sizeHuge: const TextStyle(fontSize: 22.0)); sizeHuge: const TextStyle(fontSize: 22.0));
@ -206,6 +210,7 @@ class DefaultStyles {
code: other.code ?? code, code: other.code ?? code,
indent: other.indent ?? indent, indent: other.indent ?? indent,
align: other.align ?? align, align: other.align ?? align,
leading: other.leading ?? leading,
sizeSmall: other.sizeSmall ?? sizeSmall, sizeSmall: other.sizeSmall ?? sizeSmall,
sizeLarge: other.sizeLarge ?? sizeLarge, sizeLarge: other.sizeLarge ?? sizeLarge,
sizeHuge: other.sizeHuge ?? sizeHuge); sizeHuge: other.sizeHuge ?? sizeHuge);

@ -141,7 +141,7 @@ class EditableTextBlock extends StatelessWidget {
index: index, index: index,
indentLevelCounts: indentLevelCounts, indentLevelCounts: indentLevelCounts,
count: count, count: count,
style: defaultStyles!.paragraph!.style, style: defaultStyles!.leading!.style,
attrs: attrs, attrs: attrs,
width: 32.0, width: 32.0,
padding: 8.0, padding: 8.0,
@ -150,20 +150,20 @@ class EditableTextBlock extends StatelessWidget {
if (attrs[Attribute.list.key] == Attribute.ul) { if (attrs[Attribute.list.key] == Attribute.ul) {
return _BulletPoint( return _BulletPoint(
style: defaultStyles!.paragraph!.style style:
.copyWith(fontWeight: FontWeight.bold), defaultStyles!.leading!.style.copyWith(fontWeight: FontWeight.bold),
width: 32, width: 32,
); );
} }
if (attrs[Attribute.list.key] == Attribute.checked) { if (attrs[Attribute.list.key] == Attribute.checked) {
return _Checkbox( 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) { if (attrs[Attribute.list.key] == Attribute.unchecked) {
return _Checkbox( return _Checkbox(
style: defaultStyles!.paragraph!.style, width: 32, isChecked: false); style: defaultStyles!.leading!.style, width: 32, isChecked: false);
} }
if (attrs.containsKey(Attribute.codeBlock.key)) { if (attrs.containsKey(Attribute.codeBlock.key)) {

Loading…
Cancel
Save