Overview
TheEditorStyle class allows you to customize the visual appearance and behavior of the editor. You can pass an EditorStyle instance to the AppFlowyEditor widget to configure styling properties.
Constructors
EditorStyle()
Creates a custom editor style with full control over all properties.EditorStyle.desktop()
Creates an editor style optimized for desktop platforms with sensible defaults:- Horizontal padding: 100
- Cursor color: #00BCF0
- Selection color: rgba(111, 201, 231, 0.21)
- Font size: 16
- Cursor width: 2.0
EditorStyle.mobile()
Creates an editor style optimized for mobile platforms with sensible defaults:- Horizontal padding: 20
- Cursor color: #00BCF0
- Drag handle color: #00BCF0
- Selection color: rgba(111, 201, 231, 0.21)
- Font size: 16
- Magnifier size: 72x48
- Mobile drag handle ball size: 8x8
- Auto-dismiss duration: 3 seconds
Properties
Basic Styling
The padding around the editor content.Default (Desktop):
EdgeInsets.symmetric(horizontal: 100)Default (Mobile): EdgeInsets.symmetric(horizontal: 20)The maximum width of the editor content. When set, the editor will not exceed this width.
The scale factor for text rendering. Use this to adjust text size for accessibility.
The default text direction for the editor. Can be used to set RTL or LTR text direction.
Cursor Styling
The color of the text cursor.Default:
Color(0xFF00BCF0) (cyan blue)The width of the text cursor in pixels.
Selection Styling
The background color of selected text.Default:
Color.fromARGB(53, 111, 201, 231) (light cyan with transparency)Text Styling
Configuration for text styles including bold, italic, underline, strikethrough, links, and code.This configuration is used by all text-based components as the default styling. Individual block components may override these styles with their own
BlockComponentConfiguration.See TextStyleConfiguration for details.Custom decorator for text spans with attributes.Use this to customize how text with specific attributes (like mentions, hashtags, or custom annotations) is rendered. You can also override built-in text span rendering.Default (Desktop):
defaultTextSpanDecoratorForAttributeDefault (Mobile): mobileTextSpanDecoratorForAttributeBuilder for text span overlays.Use this to create custom overlays that appear on top of text spans, such as tooltips or inline menus.
Mobile-Specific Styling
The color of the drag handle on mobile platforms.Note: This color is ignored on Android.Default (Mobile):
Color(0xFF00BCF0) (cyan blue)The size of the magnifier widget on mobile platforms.Mobile only. The magnifier appears when selecting text to help users see the cursor position.
The size of the drag handle ball on mobile platforms.Mobile only.
The width of the drag handle line on mobile platforms.Mobile only.
Extension of the drag handle hit test area from the top.By default, the hit test area matches the ball size. Set this to extend the tappable area. For example, a value of 10 adds 20 pixels to the hit test area (10 pixels on each side).Mobile only.
Extension of the drag handle hit test area from the left.By default, the hit test area matches the ball size. Set this to extend the tappable area.Mobile only.
Extension of the drag handle hit test area width.By default, the hit test area matches the ball size. Set this to extend the tappable area.Mobile only.
Extension of the drag handle hit test area height.By default, the hit test area matches the ball size. Set this to extend the tappable area.Mobile only.
Whether to enable haptic feedback when dragging the selection handle on Android.Android only.
The duration after which the collapsed selection handle is automatically dismissed when no user interaction is detected.Android only.
Methods
copyWith()
Creates a copy of the currentEditorStyle with the specified properties updated.
Usage Examples
Basic Desktop Editor
Custom Styling
Mobile Editor with Custom Drag Handle
Modifying Existing Style
Related
- TextStyleConfiguration - Configure text formatting styles
- BlockComponentConfiguration - Configure individual block components