Paragraph class
Represents a paragraph consisting of lines of text or embedded content with optional attributes.
This class encapsulates the structure of a paragraph, which can contain multiple lines and may have associated block-level attributes and a specific paragraph type.
The lines property holds a list of Line objects representing individual lines within the paragraph.
The type property specifies the type of paragraph, if any, such as normal text or an embedded content.
The blockAttributes property is a map that can hold additional attributes specific to the paragraph block.
Example usage:
Paragraph paragraph = Paragraph(
lines: [
Line(data: 'First line'),
Line(data: 'Second line'),
],
type: ParagraphType.block,
blockAttributes: {'indent': 2,'alignment': 'right'},
);
paragraph.insert(Line(data: 'Third line'));
paragraph.setType(ParagraphType.block);
Constructors
-
Paragraph({required List<
Line> lines, Map<String, dynamic> ? blockAttributes, ParagraphType? type}) - Constructs a Paragraph instance with required properties.
- Paragraph.fromEmbed(Operation operation)
-
Constructs a Paragraph instance from a Quill Delta embed operation.
factory
Properties
-
blockAttributes
↔ Map<
String, dynamic> ? -
Additional attributes specific to the paragraph block.
getter/setter pair
- clone → Paragraph
-
Creates a clone of the current paragraph.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
lines
→ List<
Line> -
List of lines composing the paragraph.
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true
, thetoString
method will be overridden to output this instance'sprops
.no setterinherited - type ↔ ParagraphType?
-
The type of the paragraph.
getter/setter pair
Methods
-
clean(
) → void - Clears all lines from the paragraph.
-
insert(
Line line) → void - Inserts a new Line into the paragraph.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeLine(
int index) → void - Removes a line from the paragraph at the specified index.
-
setAttributes(
Map< String, dynamic> ? attrs) → void - Sets additional attributes for the paragraph block.
-
setType(
ParagraphType? lineType) → void - Sets the type of the paragraph.
-
setTypeSafe(
ParagraphType? lineType) → void - Sets the type of the paragraph if it hasn't been set already.
-
toString(
) → String - A string representation of this object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited