EasyAttribute<T extends Object?> class
abstract
The base class for all text attributes in the EasyText system.
EasyAttribute represents a styling or formatting property that can be applied to text content. Attributes can be either inline (applied to specific text ranges) or block-level (applied to entire paragraphs or blocks).
Attribute Types:
- Inline Attributes: Applied to text selections (color, bold, italic, etc.)
- Block Attributes: Applied to entire paragraphs (alignment, indentation, etc.)
- Exclusive Attributes: Cannot be combined with other exclusive attributes
Usage Example:
// Create custom attribute
class CustomAttr extends EasyAttribute<String> {
CustomAttr(String value) : super(value: value);
@override
String get key => 'custom';
@override
bool get isInline => true;
@override
bool get exclusive => false;
@override
bool canMergeWith(EasyAttribute attribute) => true;
@override
EasyAttribute clone(String value) => CustomAttr(value);
}
Constructors
- EasyAttribute({required T value})
-
Creates an EasyAttribute with the given
value.const
Properties
- exclusive → bool
-
Determines if this attribute is exclusive and cannot be combined with
other exclusive attributes.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isInline → bool
-
Determines whether this attribute is applied inline (to text ranges)
or as a block attribute (to paragraphs/blocks).
no setter
- key → String
-
A unique identifier key for this attribute type.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
The value of this attribute. The type
Tdepends on the specific attribute.final
Methods
-
canMergeWith(
EasyAttribute< Object?> attribute) → bool - Determines if this attribute can be merged with another attribute of the same type or different types.
-
clone(
T? value) → EasyAttribute< Object?> -
Creates a new instance of this attribute with the given
value. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
covariant EasyAttribute< Object?> other) → bool -
The equality operator.
override
Static Properties
-
alternativeNames
→ Map<
String, EasyAttribute< Object?> > -
Returns all the names that are related with this EasyAttributeStyles
final
-
blocks
→ Map<
String, EasyAttribute< Object?> > -
Registry of all block-level attributes.
final
- codeblock → CodeBlockAttribute
-
Code block attribute (active state).
final
-
exclusives
→ Map<
String, EasyAttribute< Object?> > -
Registry of exclusive attributes that cannot be combined.
final
-
inlineKeys
→ Map<
String, EasyAttribute< Object?> > -
Registry of all inline attributes.
final
Static Methods
-
addCustom(
Map< String, EasyAttribute< attrs) → voidObject?> > - Adds custom attributes to the global attribute registry.
-
fromKeyValue(
String key, dynamic value, {bool acceptUnknown = true}) → EasyAttribute< Object?> ? - Creates an attribute instance from a key-value pair.
Constants
- align → const AlignmentAttribute
- Text alignment attribute (default alignment).
- bg → const BackgroundColorAttribute
- Background color attribute for text.
- blockquote → const BlockquoteAttribute
- Blockquote attribute for quoted text.
- bold → const BoldAttribute
- Bold text formatting attribute.
- centerAlign → const AlignmentAttribute
- Center text alignment attribute.
- code → const InlineCodeAttribute
- Inline code formatting attribute.
- color → const ColorAttribute
- Text color attribute.
- dimensions → const DimensionsAttribute
- Dimensions attribute for controlling width/height of text blocks.
- direction → const TextDirectionAttribute
- Text direction attribute (default direction).
- fontFamily → const FontFamilyAttribute
- Font family attribute.
- fontSize → const FontSizeAttribute
- Font size attribute.
- h1 → const HeaderAttribute
- Header level 1 attribute.
- h2 → const HeaderAttribute
- Header level 2 attribute.
- h3 → const HeaderAttribute
- Header level 3 attribute.
- h4 → const HeaderAttribute
- Header level 4 attribute.
- h5 → const HeaderAttribute
- Header level 5 attribute.
- h6 → const HeaderAttribute
- Header level 6 attribute.
- header → const HeaderAttribute
- Header attribute (default level).
- indentation → const BlockIndentAttribute
- Block indentation attribute.
- italic → const ItalicAttribute
- Italic text formatting attribute.
- leftAlign → const AlignmentAttribute
- Left text alignment attribute.
- lineHeight → const LineheightAttribute
- Line height attribute (default height).
- lineHeightHigh → const LineheightAttribute
- High line height attribute.
- lineHeightNormal → const LineheightAttribute
- Normal line height attribute.
- lineHeightSmall → const LineheightAttribute
- Small line height attribute.
- lineHeightVeryHigh → const LineheightAttribute
- Very high line height attribute.
- link → const LinkAttribute
- Hyperlink attribute for making text clickable.
- list → const ListAttribute
- List attribute (default type).
- ltr → const TextDirectionAttribute
- Left-to-right text direction attribute.
- ol → const ListAttribute
- Ordered list attribute (numbered).
- rightAlign → const AlignmentAttribute
- Right text alignment attribute.
- rtl → const TextDirectionAttribute
- Right-to-left text direction attribute.
- script → const ScriptAttribute
- Script font formatting attribute.
- strike → const StrikeAttribute
- Strikethrough text formatting attribute.
- subscript → const ScriptAttribute
- Subscript font formatting attribute.
- superscript → const ScriptAttribute
- Superscript font formatting attribute.
- todo → const ListAttribute
- Todo list attribute (checkboxes).
- ul → const ListAttribute
- Unordered list attribute (bullet points).
- underline → const UnderlineAttribute
- Underline text formatting attribute.