Flutter Advanced HTML Editor
A powerful and customizable HTML editor for Flutter.
A comprehensive and feature-rich HTML editor for Flutter applications. It provides a powerful rich text editing experience with extensive formatting options, customizable themes, and a flexible toolbar system.
đŦ Demo
⨠Features
đ¨ Rich Text Formatting: Bold, italic, underline, strikethrough, colors, fonts, and sizes
đ Content Structure: Headings, paragraphs, lists, blockquotes, and code blocks
đ Media Support: Insert links, images, and tables
đ Customizable Themes: Light, dark, and custom theme support
đ ī¸ Flexible Toolbar: Choose only the buttons you need
âŠī¸ Undo/Redo: Full history support
đą Responsive: Works across all screen sizes
đ§ Easy Integration: Simple API with clear documentation
đ Quick Demo HtmlEditorWidget( controller: HtmlEditorController(), theme: HtmlEditorTheme.light(), initialContent: '
Hello World đ
', )đĻ Installation
Add this to your pubspec.yaml:
dependencies: flutter_advanced_html_editor: ^1.0.0
Run:
flutter pub get
đ Basic Usage import 'package:flutter/material.dart'; import 'package:flutter_advanced_html_editor/flutter_advanced_html_editor.dart';
class MyEditorPage extends StatefulWidget { @override _MyEditorPageState createState() => _MyEditorPageState(); }
class _MyEditorPageState extends State
@override void initState() { super.initState(); _controller = HtmlEditorController(); }
@override void dispose() { _controller.dispose(); super.dispose(); }
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('HTML Editor')), body: HtmlEditorWidget( controller: _controller, theme: HtmlEditorTheme.light(), height: 400, initialContent: '
Start writing...
', onContentChanged: (content) { print('Content changed: $content'); }, ), ); } }⥠Advanced Usage đ¨ Custom Theme HtmlEditorWidget( controller: _controller, theme: HtmlEditorTheme.custom( primaryColor: '#2196F3', backgroundColor: '#FFFFFF', textColor: '#000000', toolbarBackgroundColor: '#F5F5F5', ), )
đ ī¸ Custom Toolbar
HtmlEditorWidget(
controller: _controller,
theme: HtmlEditorTheme.light(),
customToolbarItems:
HtmlEditorToolbarItem.bold,
HtmlEditorToolbarItem.italic,
HtmlEditorToolbarItem.underline,
HtmlEditorToolbarItem.textColor,
HtmlEditorToolbarItem.alignLeft,
HtmlEditorToolbarItem.alignCenter,
HtmlEditorToolbarItem.alignRight,
HtmlEditorToolbarItem.unorderedList,
HtmlEditorToolbarItem.orderedList,
HtmlEditorToolbarItem.link,
HtmlEditorToolbarItem.image,
,
)
đŽ Controller Methods // Get HTML content String htmlContent = await _controller.getHtml();
// Set HTML content await _controller.setHtml('
New Content
');// Insert at cursor await _controller.insertHtml('Bold text');
// Formatting await _controller.bold(); await _controller.italic(); await _controller.underline(); await _controller.setTextColor('#FF0000');
// Undo/Redo & Management await _controller.undo(); await _controller.redo(); await _controller.clear(); await _controller.focus();
// Stats int wordCount = await _controller.getWordCount(); int charCount = await _controller.getCharacterCount(); bool hasContent = await _controller.hasContent();
đ ī¸ Toolbar Items
Full list of available items:
undo, redo, bold, italic, underline, strikethrough, textColor, backgroundColor, fontFamily, fontSize, alignLeft, alignCenter, alignRight, justify, unorderedList, orderedList, indent, outdent, link, image, table, code, removeFormat, heading1, heading2, heading3, paragraph, blockquote, horizontalRule.
đ Themes // Predefined HtmlEditorTheme.light(); HtmlEditorTheme.dark();
// Custom HtmlEditorTheme.custom( primaryColor: '#2196F3', backgroundColor: '#FFFFFF', textColor: '#000000', toolbarBackgroundColor: '#F5F5F5', );
đ Callbacks
HtmlEditorWidget(
onContentChanged: (content) => print("Changed: $content"),
onSelectionChanged: (selection) {
print("Selected: ${selection'selectedText'}");
},
)
đģ Platform Support
â Android
â iOS
â Web
â macOS
â Windows
â Linux
đ Requirements
Flutter >=3.0.0
Dart >=3.0.0
đ Dependencies
webview_flutter: ^4.4.2 â Render HTML editor
file_picker: ^6.1.1 â Image/file selection
đ¤ī¸ Roadmap
RTL support improvements
Insert videos & embeds
Extend plugin system (custom buttons)
Export to Markdown
â FAQ
Q: Does it support RTL (Arabic)? A: Basic support exists.
Q: Can I get plain text instead of HTML? A: Yes, use the controller methods.
Q: Does it work on both mobile & web? A: Yes, fully supported.
đ¤ Contributing
Contributions are welcome! Please open an Issue or submit a PR.
đ License
This project is licensed under the MIT License â see LICENSE.
đ Changelog
See CHANGELOG.md for details.
Libraries
- flutter_advanced_html_editor
- Flutter Advanced HTML Editor