diff --git a/lib/src/models/documents/attribute.dart b/lib/src/models/documents/attribute.dart index 9ce2210f..365991a0 100644 --- a/lib/src/models/documents/attribute.dart +++ b/lib/src/models/documents/attribute.dart @@ -342,23 +342,23 @@ class HeaderAttribute extends Attribute { : super('header', AttributeScope.block, level); } +/// This attribute represents the space between text lines. The line height can be +/// adjusted using predefined constants or custom values +/// +/// The attribute at the json looks like: "attributes":{"line-height": 1.5 } class LineHeightAttribute extends Attribute { const LineHeightAttribute({double? lineHeight}) : super('line-height', AttributeScope.block, lineHeight); - /// "attributes":{"line-height": 1.0 } static const Attribute lineHeightNormal = LineHeightAttribute(lineHeight: 1); - /// "attributes":{"line-height": 1.15 } static const Attribute lineHeightTight = LineHeightAttribute(lineHeight: 1.15); - /// "attributes":{"line-height": 1.5 } static const Attribute lineHeightOneAndHalf = LineHeightAttribute(lineHeight: 1.5); - /// "attributes":{"line-height": 2.0 } static const Attribute lineHeightDouble = LineHeightAttribute(lineHeight: 2); } diff --git a/lib/src/widgets/quill/text_line.dart b/lib/src/widgets/quill/text_line.dart index b0bc25cc..b802d1fb 100644 --- a/lib/src/widgets/quill/text_line.dart +++ b/lib/src/widgets/quill/text_line.dart @@ -304,6 +304,8 @@ class _TextLineState extends State { defaultStyles.lineHeightDouble!.style, }; + // If the lineHeight attribute isn't null, then get just the height param instead whole TextStyle + // to avoid modify the current style of the text line textStyle = textStyle.merge(textStyle.copyWith(height: x[lineHeight]?.height));