quill_html_editor 0.1.5 copy "quill_html_editor: ^0.1.5" to clipboard
quill_html_editor: ^0.1.5 copied to clipboard

outdated

HTML rich text editor for Android, iOS and Web, using the QuilJS library.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:quill_html_editor/quill_html_editor.dart';

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  ///  create a key to access the the editor methods
  final GlobalKey<QuillHtmlEditorState> htmlKey =
      GlobalKey<QuillHtmlEditorState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Quill Html Editor'),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          QuillHtmlEditor(
            editorKey: htmlKey,
            height: MediaQuery.of(context).size.height * 0.7,
            isEnabled:
                true, // to disable the editor set it to false (default value is true)
          ),
        ],
      ),
    );
  }

  /// to get the html text from editor
  void getHtmlText() async {
    String? htmlText = await htmlKey.currentState?.getText();
    debugPrint(htmlText.toString());
  }

  /// to set the html text to editor
  void setHtmlText(String text) async {
    await htmlKey.currentState?.setText(text);
  }

  /// to clear the editor
  void clearEditor() => htmlKey.currentState?.clear();

  /// to enable/disable the editor
  void enableEditor(bool enable) => htmlKey.currentState?.enableEditor(enable);
}
246
likes
160
pub points
97%
popularity

Publisher

unverified uploader

HTML rich text editor for Android, iOS and Web, using the QuilJS library.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, webviewx

More

Packages that depend on quill_html_editor