flutter_minimal_html_editor 1.0.1 copy "flutter_minimal_html_editor: ^1.0.1" to clipboard
flutter_minimal_html_editor: ^1.0.1 copied to clipboard

PlatformAndroidiOS
outdated

Minimal HTML WYSIWYG editor with only context menu formatting options. Supports flexible height, customizing appearance, and various text callbacks and methods.

example/lib/main.dart

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Minimal Html Editor',
      home: MyHomePage(title: 'Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final _scrollController = ScrollController();
  late EditorController _editorController;
  @override
  void initState() {
    _editorController = EditorController(scrollController: _scrollController);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      initialIndex: 0,
      length: 2,
      child: Scaffold(
        body: Scaffold(
          appBar: AppBar(
            title: Text("Minimal Html Editor demo"),
            bottom: TabBar(
              tabs: [
                Text("Flexible height, magenta background"),
                Text("Fixed height and scrollable"),
              ],
            ),
          ),
          body: TabBarView(
            children: [
              SingleChildScrollView(
                controller: _scrollController,
                child: Column(
                  children: <Widget>[
                    Center(
                      child: Text(
                        "Flexible height, magenta background",
                        style: TextStyle(fontSize: 20),
                      ),
                    ),
                    HtmlEditor(
                      flexibleHeight: true,
                      autoAdjustScroll: true,
                      controller: _editorController,
                      minHeight: 150,
                      padding: EdgeInsets.all(20),
                      backgroundColorCssCode: "magenta",
                      initialText: "Some initial text",
                      placeholder: "Chào thế giới",
                      printWebViewLog: true,
                      useAndroidHybridComposition: true,
                      showLoadingWheel: true,
                      scaleFactor: 2,
                      onChange: (content, height) => print(content),
                    ),
                    Center(
                      child: Text(
                        "Flexible height, magenta background",
                        style: TextStyle(fontSize: 20),
                      ),
                    ),
                  ],
                ),
              ),
              SingleChildScrollView(
                child: Column(
                  children: <Widget>[
                    Center(
                      child: Text(
                        "Fixed height and scrollable",
                        style: TextStyle(fontSize: 20),
                      ),
                    ),
                    HtmlEditor(
                      backgroundColorCssCode: "#fafafa",
                      minHeight: 250,
                      initialText: "Some initial text",
                      placeholder: "Chào thế giới",
                    ),
                    Center(
                      child: Text(
                        "Fixed height and scrollable",
                        style: TextStyle(fontSize: 20),
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
2
likes
130
points
113
downloads

Publisher

unverified uploader

Weekly Downloads

Minimal HTML WYSIWYG editor with only context menu formatting options. Supports flexible height, customizing appearance, and various text callbacks and methods.

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_inappwebview

More

Packages that depend on flutter_minimal_html_editor