textf 1.2.0 copy "textf: ^1.2.0" to clipboard
textf: ^1.2.0 copied to clipboard

Inline Markdown-like formatting for Flutter - as drop-in replacements for `Text` and `TextEditingController`. Bold, italic, code, [URL links](.), highlights, super/subscript.

example/README.md

textf Example #

Drop-in replacement for Flutter's Text widget with inline Markdown-like formatting.

#

Quick Start #

import 'package:textf/textf.dart';

Textf(
  '**Bold**, *italic*, `code`, and [links](https://flutter.dev)',
  style: TextStyle(fontSize: 16),
)

Formatting #

Format Syntax
Bold **bold**
Italic *italic*
Bold + Italic ***both***
Strikethrough ~~strike~~
Underline ++underline++
Highlight ==highlight==
Inline code `code`
Superscript ^super^
Subscript ~sub~
Link [label](url)

Note: No spaces around markers — *italic* works, * italic * doesn't.

Examples #

Basic Usage #

Textf('Hello **World**!')

String Extension #

'**Bold** text'.textf(style: TextStyle(fontSize: 18))
TextfOptions(
  onLinkTap: (url, displayText) => launchUrl(Uri.parse(url)),
  linkStyle: TextStyle(color: Colors.blue),
  child: Textf('[Tap me](https://example.com)'),
)

Custom Styles #

TextfOptions(
  boldStyle: TextStyle(fontWeight: FontWeight.w900),
  codeStyle: TextStyle(fontFamily: 'monospace'),
  highlightStyle: TextStyle(backgroundColor: Colors.yellow),
  child: Textf('Style **everything** your way'),
)

Widget Placeholders #

Textf(
  'Rate this app {star}',
  placeholders: {
    'star': WidgetSpan(child: Icon(Icons.star, color: Colors.amber)),
  },
)

Live Formatting in Text Fields #

final controller = TextfEditingController();

TextField(
  controller: controller,
  decoration: InputDecoration(hintText: 'Try **bold** or *italic*'),
)

Features #

Zero dependencies — pure Dart ✓ Max 2-level nesting — safe and predictable ✓ Escape with backslash\*not italic\*Fully customizable — styles and callbacks via TextfOptions ✓ Efficient — LRU caching and single-pass tokenization

See pub.dev for full documentation.

47
likes
0
points
690
downloads

Publisher

verified publisherphilippgerber.li

Weekly Downloads

Inline Markdown-like formatting for Flutter - as drop-in replacements for `Text` and `TextEditingController`. Bold, italic, code, [URL links](.), highlights, super/subscript.

Repository (GitHub)
View/report issues

Topics

#text #markdown #formatting #text-editing #rich-text

License

unknown (license)

Dependencies

flutter

More

Packages that depend on textf