added docs comments

pull/1972/head
CatHood0 10 months ago
parent ec671938b2
commit ad0aac57ed
  1. 8
      lib/src/models/documents/attribute.dart
  2. 2
      lib/src/widgets/quill/text_line.dart

@ -342,23 +342,23 @@ class HeaderAttribute extends Attribute<int?> {
: super('header', AttributeScope.block, level); : 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<double?> { class LineHeightAttribute extends Attribute<double?> {
const LineHeightAttribute({double? lineHeight}) const LineHeightAttribute({double? lineHeight})
: super('line-height', AttributeScope.block, lineHeight); : super('line-height', AttributeScope.block, lineHeight);
/// "attributes":{"line-height": 1.0 }
static const Attribute<double?> lineHeightNormal = static const Attribute<double?> lineHeightNormal =
LineHeightAttribute(lineHeight: 1); LineHeightAttribute(lineHeight: 1);
/// "attributes":{"line-height": 1.15 }
static const Attribute<double?> lineHeightTight = static const Attribute<double?> lineHeightTight =
LineHeightAttribute(lineHeight: 1.15); LineHeightAttribute(lineHeight: 1.15);
/// "attributes":{"line-height": 1.5 }
static const Attribute<double?> lineHeightOneAndHalf = static const Attribute<double?> lineHeightOneAndHalf =
LineHeightAttribute(lineHeight: 1.5); LineHeightAttribute(lineHeight: 1.5);
/// "attributes":{"line-height": 2.0 }
static const Attribute<double?> lineHeightDouble = static const Attribute<double?> lineHeightDouble =
LineHeightAttribute(lineHeight: 2); LineHeightAttribute(lineHeight: 2);
} }

@ -304,6 +304,8 @@ class _TextLineState extends State<TextLine> {
defaultStyles.lineHeightDouble!.style, 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 =
textStyle.merge(textStyle.copyWith(height: x[lineHeight]?.height)); textStyle.merge(textStyle.copyWith(height: x[lineHeight]?.height));

Loading…
Cancel
Save