Inputs
Rich Editor
LiqRichEditor is a small inline rich-text editor with a 3-button
toolbar above the editable area. It supports three character formats —
bold, italic, and underline — over a single paragraph.
The scope is deliberately tight. Block formats (headings, lists), images, and links are out of scope for this component; reach for a full WYSIWYG when you need them.
State lives on a LiqRichEditorController, which owns the current
LiqRichValue (plain text + a list of LiqRichRanges) and exposes
toggleFormat / selectionHasFormat for selection-aware operations.
Default
// ignore_for_file: file_names // hyphenated name required by snippet manifest conventionimport 'package:docs_snippets/src/snippet_frame.dart';import 'package:flutter/widgets.dart';import 'package:liqkit_ui/liqkit_ui.dart';/// Snippet builder consumed by `apps/docs_snippets/lib/src/routes.g.dart`.Widget richEditorDefaultBuilder(BuildContext context) { return SnippetFrame(maxWidth: 480, child: _RichEditorDefaultDemo());}class _RichEditorDefaultDemo extends StatefulWidget { @override State<_RichEditorDefaultDemo> createState() => _RichEditorDefaultDemoState();}class _RichEditorDefaultDemoState extends State<_RichEditorDefaultDemo> { late final LiqRichEditorController _controller = LiqRichEditorController( value: const LiqRichValue( text: 'liqkit_ui ships rich text out of the box.', ranges: <LiqRichRange>[ LiqRichRange(start: 0, end: 9, format: LiqRichFormat.bold), LiqRichRange(start: 16, end: 25, format: LiqRichFormat.italic), ], ), ); @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return LiqRichEditor(controller: _controller); }}
Empty
// ignore_for_file: file_names // hyphenated name required by snippet manifest conventionimport 'package:docs_snippets/src/snippet_frame.dart';import 'package:flutter/widgets.dart';import 'package:liqkit_ui/liqkit_ui.dart';/// Snippet builder consumed by `apps/docs_snippets/lib/src/routes.g.dart`.Widget richEditorEmptyBuilder(BuildContext context) { return SnippetFrame(maxWidth: 480, child: _RichEditorEmptyDemo());}class _RichEditorEmptyDemo extends StatefulWidget { @override State<_RichEditorEmptyDemo> createState() => _RichEditorEmptyDemoState();}class _RichEditorEmptyDemoState extends State<_RichEditorEmptyDemo> { final LiqRichEditorController _controller = LiqRichEditorController(); @override void dispose() { _controller.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return LiqRichEditor(controller: _controller); }}