<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Philipp Gerber on Medium]]></title>
        <description><![CDATA[Stories by Philipp Gerber on Medium]]></description>
        <link>https://medium.com/@p.h.gerber?source=rss-30760415e868------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TC92Wp1UiGpf-LAfIuICLQ.png</url>
            <title>Stories by Philipp Gerber on Medium</title>
            <link>https://medium.com/@p.h.gerber?source=rss-30760415e868------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 07:18:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@p.h.gerber/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Textf 2.0: Ready for Flutter’s Decoupled Future]]></title>
            <link>https://medium.com/@p.h.gerber/textf-2-0-ready-for-flutters-decoupled-future-79a6a0685685?source=rss-30760415e868------2</link>
            <guid isPermaLink="false">https://medium.com/p/79a6a0685685</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[formatting]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[markdown]]></category>
            <dc:creator><![CDATA[Philipp Gerber]]></dc:creator>
            <pubDate>Mon, 26 Oct 2026 12:41:19 GMT</pubDate>
            <atom:updated>2026-10-26T12:41:19.251Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>Headings, live editing in text fields, and one widget for every design system.</em></h4><ul><li>Part 1: <a href="https://medium.com/@p.h.gerber/textf-1-0-inline-text-formatting-for-flutter-without-the-overhead-3d15f02dcfe3">Textf 1.0: Inline Text Formatting for Flutter Without the Overhead</a></li><li>Part 2: <a href="https://medium.com/@p.h.gerber/building-rich-text-components-in-flutter-with-textf-47265f3e06cc">Building Rich Text Components in Flutter with Textf</a></li><li>Part 3: Textf 2.0: Ready for Flutter’s Decoupled Future</li></ul><p>When I released Textf 1.0, the idea was simple: replace Text with Textf and write **bold** instead of nesting TextSpans.</p><p>A few things have happened since then. Flutter started moving Material and Cupertino out of the framework core. The community asked for headings. And Textf learned to format text while you type it.</p><p>Textf 2.0 brings these together. This article covers what’s new.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_pH2MsU0YP570nTqu-iHkA.png" /></figure><h3>Flutter Is Decoupling Its Design Systems</h3><p>Flutter is <a href="https://flutter.dev/blog/decoupling-material-cupertino">moving Material and Cupertino out of the framework core</a> and into their own packages, material_ui and cupertino_ui. For apps, this is mostly a matter of imports. For packages it raises a question: which design system does your package assume?</p><p>A package that imports material.dart takes Material along into every app that uses it, including a Cupertino app or an app with its own design system.</p><p>Textf 2.0 doesn’t import either. It builds only on Flutter’s core layers (widgets, painting, gestures, foundation) and never reads a design-system theme. Its defaults come from the text they render in, meaning the ambient DefaultTextStyle, in the same way Text works.</p><p>The result is that one widget behaves the same everywhere:</p><pre>WidgetsApp(<br>  color: const Color(0xFF000000),<br>  builder: (context, _) =&gt; const DefaultTextStyle(<br>    style: TextStyle(fontSize: 18, color: Color(0xFF222222)),<br>    child: Center(<br>      child: Textf(<br>        &#39;Same **widget**, *any* design system: `code`, &#39;<br>        &#39;==highlights== and [links](https://flutter.dev/).&#39;,<br>      ),<br>    ),<br>  ),<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2_QI2ki81yWQV90mFP1z9w.png" /><figcaption><em>Same widget, four design systems.</em></figcaption></figure><p>If your app uses Material today, Textf still works the way you&#39;re used to. You just aren&#39;t tied to Material anymore.</p><h3>Headings and Horizontal Rules</h3><p>In Part 1, I wrote that Textf is <em>not designed for full documents with headings and lists</em>. That’s still true for documents. But short texts often need a little structure: a release note with a title, an onboarding card with a section break, a chat message with a heading.</p><p>Textf 2.0 supports ATX headings and thematic breaks:</p><pre>Textf(<br>  &#39;# Release notes\n&#39;<br>  &#39;## Version 2.0\n&#39;<br>  &#39;Textf now supports **headings** and horizontal rules.\n&#39;<br>  &#39;---\n&#39;<br>  &#39;Still *zero* dependencies.&#39;,<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQ6cnztja9O0t_aXnlCKkg.png" /><figcaption>Headings and a thematic break, rendered with Textf.</figcaption></figure><ul><li># to ###### create headings from H1 to H6, following CommonMark rules.</li><li>---, *** or ___ on their own line render as a full-width divider.</li><li>h1Style to h6Style in TextfOptions style each level. They merge onto the built-in sizes, so changing only the color keeps the heading size.</li></ul><p>Heading support started as a <a href="https://github.com/PhilippHGerber/textf/pull/10">community pull request</a>. Thank you!</p><p><strong>What didn’t change:</strong> Headings and rules apply to a single line. There are no lists, tables, images or block layout. Textf still parses in a single O(N) pass, has zero dependencies, and uses the same drop-in Text API. If you need to render full documents, a full Markdown package is still the right tool.</p><h3>Formatting While You Type: TextfEditingController</h3><p>This one has been around since 1.2, but it hasn’t come up in this series yet.</p><p>TextfEditingController is a drop-in replacement for TextEditingController. Attach it to any TextField and formatting renders live as the user types:</p><pre>final controller = TextfEditingController();<br>TextField(controller: controller)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*qAbdH5Anjgyl9dO2f-Y39A.gif" /><figcaption><em>Live formatting inside a regular TextField.</em></figcaption></figure><p>The stored value stays plain text with markers. The controller only adds styling on top, so controller.text is exactly what the user typed, and cursor positions match the raw text one to one. IME composing for languages like Chinese, Japanese and Korean works as expected.</p><p>You can choose how markers appear:</p><pre>// Markers always visible, dimmed (default)<br>TextfEditingController(markerVisibility: MarkerVisibility.always);<br><br>// Markers hide when the cursor leaves the formatted span<br>TextfEditingController(markerVisibility: MarkerVisibility.whenActive);</pre><p>The best part is that the same syntax works for input and output. What a user types into a TextfEditingController renders the same way in a Textf.</p><h3>Practical Build: Consent Checkbox</h3><p>Every app with an account has this sentence. With plain Flutter it means Text.rich, five TextSpans and two TapGestureRecognizers that you have to create and dispose in a StatefulWidget.</p><p>With Textf, it’s a StatelessWidget:</p><pre>class ConsentRow extends StatelessWidget {<br>  const ConsentRow({<br>    required this.value,<br>    required this.onChanged,<br>    super.key,<br>  });<br><br>  final bool value;<br>  final ValueChanged&lt;bool?&gt; onChanged;<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Row(<br>      children: [<br>        Checkbox(value: value, onChanged: onChanged),<br>        Expanded(<br>          child: TextfOptions(<br>            onLinkTap: (url, _) =&gt; launchUrl(Uri.parse(url)),<br>            child: Textf(<br>              &#39;I agree to the [**Terms of Service**](https://example.com/terms) &#39;<br>              &#39;and [**Privacy Policy**](https://example.com/privacy).&#39;,<br>            ),<br>          ),<br>        ),<br>      ],<br>    );<br>  }<br>}</pre><p><em>A consent row with two tappable links.</em></p><p><strong>Localization.</strong> The sentence stays a single string, which is what translators need. In languages where the two links come in a different order, they can simply move them. A reader suggested a nice addition: keep the URLs out of what translators edit by passing them as gen-l10n placeholders.</p><pre>{<br>  &quot;consent&quot;: &quot;I agree to the [**Terms of Service**]({termsUrl}) and [**Privacy Policy**]({privacyUrl}).&quot;,<br>  &quot;@consent&quot;: {<br>    &quot;placeholders&quot;: {<br>      &quot;termsUrl&quot;: { &quot;type&quot;: &quot;String&quot; },<br>      &quot;privacyUrl&quot;: { &quot;type&quot;: &quot;String&quot; }<br>    }<br>  }<br>}</pre><pre>AppLocalizations.of(context)!.consent(termsUrl, privacyUrl).textf()</pre><p>Translators can move the links, but they can’t break or change the addresses.</p><h3>When to Use Textf</h3><p><strong>Perfect for:</strong></p><ul><li>Chat messages and comments, both input and display</li><li>Notifications, tooltips and UI labels with emphasis</li><li>Internationalized strings with links and formatting</li><li>Short structured text: release notes, onboarding cards, announcements</li><li>Apps on any design system: Material, Cupertino or your own</li></ul><p><strong>Not designed for:</strong></p><ul><li>Full documents with lists, tables or images</li><li>Fenced code blocks and syntax highlighting</li><li>HTML rendering</li></ul><h3>Get Started</h3><ul><li>📦 pub.dev: pub.dev/packages/textf</li><li>🧪 Playground: textf.philippgerber.li</li><li>⭐ GitHub: github.com/PhilippHGerber/textfr/textf</li></ul><p>Questions, ideas or bugs are always welcome. Happy formatting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79a6a0685685" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Rich Text Components in Flutter with Textf (Part 2)]]></title>
            <link>https://medium.com/@p.h.gerber/building-rich-text-components-in-flutter-with-textf-47265f3e06cc?source=rss-30760415e868------2</link>
            <guid isPermaLink="false">https://medium.com/p/47265f3e06cc</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[markdown]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Philipp Gerber]]></dc:creator>
            <pubDate>Sun, 11 Jan 2026 16:27:25 GMT</pubDate>
            <atom:updated>2026-10-28T18:22:39.575Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXb26Q3zQaBhNwti3WnROA.png" /></figure><p><strong>From help tooltips to product cards: a hands-on guide to text formatting, custom styling, and interactive links.</strong></p><ul><li>Part 1: <a href="https://medium.com/@p.h.gerber/textf-1-0-inline-text-formatting-for-flutter-without-the-overhead-3d15f02dcfe3">Textf 1.0: Inline Text Formatting for Flutter Without the Overhead</a></li><li>Part 2: Building Rich Text Components in Flutter with Textf</li><li>Part 3: <a href="https://medium.com/@p.h.gerber/textf-2-0-ready-for-flutters-decoupled-future-79a6a0685685">Textf 2.0: Ready for Flutter’s Decoupled Future</a></li></ul><p>In my previous article, I introduced <strong>Textf</strong> — a lightweight alternative to full Markdown packages for inline text formatting. If you haven’t read it, the short version: Textf is a drop-in replacement for Flutter’s Text widget that adds formatting with familiar syntax like <strong>bold</strong> and <em>italic</em>.</p><p>Now let’s build something real.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXb26Q3zQaBhNwti3WnROA.png" /></figure><p>By the end of this tutorial, you’ll have created three production-ready components: a help tooltip, a product description card, and a styled notification. Along the way, you’ll learn everything Textf offers — from basic formatting to custom styling to theme integration.</p><p>Let’s start.</p><h3>Setup</h3><p>Add Textf to your pubspec.yaml:</p><pre>dependencies:<br>  textf: ^1.0.0</pre><p>Run flutter pub get, then import:</p><pre>import &#39;package:textf/textf.dart&#39;;</pre><h3>Step 1: Basic Formatting</h3><p>The simplest use of Textf is direct replacement:</p><pre>// Before<br>Text(&#39;Welcome to our app&#39;)<br><br>// After<br>Textf(&#39;Welcome to our **app**&#39;)</pre><p>Every formatting option uses intuitive syntax:</p><pre>Textf(<br>  &#39;**Bold** and *italic* and ***both***. &#39;<br>  &#39;~~Strikethrough~~ and ++underline++ and ==highlight==. &#39;<br>  &#39;Even `inline code` works.&#39;,<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*EjXB_8vbW6qDM5rkdNOJ0A.png" /><figcaption>Rendered output showing all basic formatting styles.</figcaption></figure><p><strong>Escaping Special Characters</strong><br>Need a literal asterisk? Use a backslash. Using a raw string (r’…’) makes this cleaner:</p><pre>Textf(r&#39;Ratings: \*\*\*\*\* (5 stars)&#39;)<br>// Renders: Ratings: ***** (5 stars)</pre><h3>Step 2: Superscript and Subscript</h3><p>Textf handles scientific notation cleanly:</p><pre>Textf(&#39;Einstein\&#39;s famous equation: E = mc^2^&#39;)<br>Textf(&#39;The chemical formula for water: H~2~O&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*U0L_4cLBz7rT3UNn4Am-TQ.png" /><figcaption>Rendered E=mc² and H₂O</figcaption></figure><h3>Step 3: Interactive Links</h3><p>Links in Textf aren’t just styled text — they’re tappable.</p><p><strong>Basic Links</strong></p><pre>Textf(&#39;Visit [flutter.dev](https://flutter.dev) for documentation.&#39;)</pre><p><strong>Handling Taps</strong><br>Wrap your widget tree with TextfOptions to provide a tap handler. If you are using url_launcher, the pattern looks like this:</p><p><em>(Note: Ensure you’ve configured your AndroidManifest/Info.plist for url_launcher appropriately)</em></p><pre>import &#39;package:url_launcher/url_launcher.dart&#39;;<br><br>TextfOptions(<br>  onLinkTap: (url, displayText) async {<br>    final uri = Uri.parse(url);<br>    if (await canLaunchUrl(uri)) {<br>      await launchUrl(uri);<br>    }<br>  },<br>  child: Textf(&#39;Check out [this guide](https://flutter.dev)!&#39;),<br>)</pre><p><strong>Hover Effects</strong><br>For desktop and web, add hover feedback:</p><pre>TextfOptions(<br>  onLinkTap: (url, _) =&gt; launchUrl(Uri.parse(url)),<br>  onLinkHover: (url, displayText, {required isHovering}) {<br>    // Update cursor, show preview, log analytics...<br>  },<br>  child: Textf(&#39;Read [the documentation](https://flutter.dev).&#39;),<br>)</pre><h3>Step 4: Custom Styling with TextfOptions</h3><p>Default styles work well, but real apps need brand customization. TextfOptions controls how every format type renders.</p><pre>TextfOptions(<br>  boldStyle: TextStyle(<br>    fontWeight: FontWeight.w900,<br>    color: Colors.indigo,<br>  ),<br>  italicStyle: TextStyle(<br>    fontStyle: FontStyle.italic,<br>    color: Colors.purple,<br>  ),<br>  highlightStyle: TextStyle(<br>    backgroundColor: Colors.lightBlueAccent[200],<br>    color: Colors.black87,<br>  ),<br>  child: Textf(&#39;This is **bold** and *italic* and ==highlighted==.&#39;),<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*R9PQgEZIFkf4TSatvzXl8w.png" /><figcaption>Custom styled text with indigo bold, purple italic, light blue highlight</figcaption></figure><p><strong>Link Styling</strong><br>Links have specific options:</p><pre>TextfOptions(<br>  linkStyle: TextStyle(<br>    color: Colors.teal,<br>    decoration: TextDecoration.none,<br>  ),<br>  linkHoverStyle: TextStyle(<br>    color: Colors.teal[700],<br>    decoration: TextDecoration.underline,<br>  ),<br>  linkMouseCursor: SystemMouseCursors.click,<br>  onLinkTap: (url, _) =&gt; launchUrl(Uri.parse(url)),<br>  child: Textf(&#39;Visit [our website](https://flutter.dev).&#39;),<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*KsTBssH6oCs_ry_AJHGhEw.gif" /></figure><h3>Step 5: Theme Integration</h3><p>Textf reads your app’s ThemeData automatically.</p><ol><li>Links use colorScheme.primary.</li><li>Code blocks use colorScheme.surfaceContainer background.</li><li>Code text uses colorScheme.onSurfaceVariant.</li></ol><pre>MaterialApp(<br>  theme: ThemeData.light(),<br>  darkTheme: ThemeData.dark(),<br>  themeMode: ThemeMode.system,<br>  home: Scaffold(<br>    body: Textf(&#39;This adapts to **light** and *dark* mode.&#39;),<br>  ),<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*cDpQ-P9uKAlvSrP0sBbG4g.png" /><figcaption>Theme-aware defaults for light and dark mode.</figcaption></figure><h3>Practical Build: Help Tooltip</h3><p>Let’s combine what we’ve learned into a real component.</p><pre>class HelpTooltip extends StatelessWidget {<br>  final String content;<br>  <br>  const HelpTooltip({required this.content, super.key});<br>  <br>  @override<br>  Widget build(BuildContext context) {<br>    return Container(<br>      padding: EdgeInsets.all(12),<br>      decoration: BoxDecoration(<br>        color: Colors.grey[100],<br>        borderRadius: BorderRadius.circular(8),<br>        border: Border.all(color: Colors.grey[300]!),<br>      ),<br>      child: TextfOptions(<br>        // Handle links within the tooltip<br>        onLinkTap: (url, _) =&gt; launchUrl(Uri.parse(url)),<br>        child: Textf(<br>          content,<br>          style: TextStyle(fontSize: 14, color: Colors.grey[800]),<br>        ),<br>      ),<br>    );<br>  }<br>}<br><br>// Usage<br>HelpTooltip(<br>  content: &#39;Press **Ctrl+S** to save. &#39;<br>           &#39;Files are stored in `~/Documents`. &#39;<br>           &#39;See [keyboard shortcuts](https://example.com/shortcuts) for more.&#39;,<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*yFFGCT81qVq0ZIt2XVnzsQ.png" /><figcaption><em>Rendered help tooltip with formatted text and link.</em></figcaption></figure><p>The formatting lives in the string, not the code. Easy to update, easy to localize.</p><h3>Practical Build: Product Card</h3><p>Now let’s build a component that showcases styling and theming.</p><pre>class ProductCard extends StatelessWidget {<br>  final String name;<br>  final String description;<br>  final String price;<br>  final String? salePrice;<br>  final String detailsUrl;<br>  <br>  const ProductCard({<br>    required this.name,<br>    required this.description,<br>    required this.price,<br>    this.salePrice,<br>    required this.detailsUrl,<br>    super.key,<br>  });<br>  <br>  @override<br>  Widget build(BuildContext context) {<br>    final theme = Theme.of(context);<br>    <br>    return Card(<br>      child: Padding(<br>        padding: EdgeInsets.all(16),<br>        child: TextfOptions(<br>          boldStyle: TextStyle(<br>            fontWeight: FontWeight.w700,<br>            color: theme.colorScheme.primary,<br>          ),<br>          highlightStyle: TextStyle(<br>            backgroundColor: Colors.orange[100],<br>            color: Colors.orange[900],<br>            fontWeight: FontWeight.w600,<br>          ),<br>          // Links look like standard text but clickable<br>          linkStyle: TextStyle(<br>            color: theme.colorScheme.secondary,<br>            decoration: TextDecoration.none,<br>          ),<br>          onLinkTap: (url, _) =&gt; launchUrl(Uri.parse(url)),<br>          child: Column(<br>            crossAxisAlignment: CrossAxisAlignment.start,<br>            children: [<br>              Textf(<br>                &#39;**$name**&#39;,<br>                style: theme.textTheme.titleLarge,<br>              ),<br>              SizedBox(height: 8),<br>              Textf(<br>                description,<br>                style: theme.textTheme.bodyMedium,<br>              ),<br>              SizedBox(height: 12),<br>              _buildPrice(),<br>              SizedBox(height: 8),<br>              Textf(&#39;[View details]($detailsUrl)&#39;),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>  <br>  Widget _buildPrice() {<br>    if (salePrice != null) {<br>      return Textf(<br>        &#39;~~\$$price~~ ==\$$salePrice== — *Limited time!*&#39;,<br>        style: TextStyle(fontSize: 18),<br>      );<br>    }<br>    return Textf(<br>      &#39;**\$$price**&#39;,<br>      style: TextStyle(fontSize: 18),<br>    );<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*FO55uUxXjiyzGl6b9NNlnQ.png" /><figcaption>Rendered product card with styled price, description, and link.</figcaption></figure><h3>Practical Build: Notification Banner</h3><p>One more example showing different styling:</p><pre>class NotificationBanner extends StatelessWidget {<br>  final String message;<br>  final VoidCallback onDismiss;<br>  <br>  const NotificationBanner({<br>    required this.message,<br>    required this.onDismiss,<br>    super.key,<br>  });<br>  <br>  @override<br>  Widget build(BuildContext context) {<br>    return Container(<br>      padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),<br>      color: Colors.blue[50],<br>      child: Row(<br>        children: [<br>          Icon(Icons.info_outline, color: Colors.blue[700]),<br>          SizedBox(width: 12),<br>          Expanded(<br>            child: TextfOptions(<br>              boldStyle: TextStyle(<br>                fontWeight: FontWeight.w600,<br>                color: Colors.blue[900],<br>              ),<br>              linkStyle: TextStyle(<br>                color: Colors.blue[700],<br>                fontWeight: FontWeight.w600,<br>              ),<br>              onLinkTap: (url, _) =&gt; launchUrl(Uri.parse(url)),<br>              child: Textf(<br>                message,<br>                style: TextStyle(color: Colors.blue[800]),<br>              ),<br>            ),<br>          ),<br>          IconButton(<br>            icon: Icon(Icons.close),<br>            onPressed: onDismiss,<br>          ),<br>        ],<br>      ),<br>    );<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*dQ-w3ySHM7REf_jdrq_gNQ.png" /><figcaption>Rendered notification banner</figcaption></figure><h3>Next Steps</h3><p>You now have everything you need to build production-ready formatted text in Flutter. The patterns from this tutorial — help tooltips, product cards, notifications — transfer to any component that needs rich text.</p><p>Explore further:</p><ul><li>📖 <strong>API Documentation:</strong> <a href="https://pub.dev/documentation/textf/latest/">pub.dev/documentation/textf</a></li><li>💻 <strong>Source Code:</strong> <a href="https://github.com/PhilippHGerber/textf">github.com/PhilippHGerber/textf</a></li></ul><p>Questions? Found a bug? Contributions welcome. Happy formatting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47265f3e06cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Textf 1.0: Inline Text Formatting for Flutter Without the Overhead]]></title>
            <link>https://medium.com/@p.h.gerber/textf-1-0-inline-text-formatting-for-flutter-without-the-overhead-3d15f02dcfe3?source=rss-30760415e868------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d15f02dcfe3</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[markdown]]></category>
            <category><![CDATA[formatting]]></category>
            <dc:creator><![CDATA[Philipp Gerber]]></dc:creator>
            <pubDate>Sun, 11 Jan 2026 13:56:49 GMT</pubDate>
            <atom:updated>2026-10-28T18:23:25.734Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mjaDO3FQyBkOnD-AQoy0CQ.png" /></figure><h3>Textf 1.0: Inline Text Formatting for Flutter Without the Overhead (Part 1)</h3><p><em>A drop-in Text replacement for bold, italic, links, and more — without the Markdown baggage.</em></p><ul><li>Part 1: Textf 1.0: Inline Text Formatting for Flutter Without the Overhead</li><li>Part 2: <a href="https://medium.com/@p.h.gerber/building-rich-text-components-in-flutter-with-textf-47265f3e06cc">Building Rich Text Components in Flutter with Textf</a></li><li>Part 3: <a href="https://medium.com/@p.h.gerber/textf-2-0-ready-for-flutters-decoupled-future-79a6a0685685">Textf 2.0: Ready for Flutter’s Decoupled Future</a></li></ul><p>You’re building a chat app. Users want bold messages and links. So you import a Markdown package — and suddenly you’re pulling in dozens of dependencies and support for headers, images, tables, and code blocks you’ll never use.</p><p>All you wanted was <strong>bold text</strong> and <em>links</em>.</p><p>That frustration led me to build <strong>Textf</strong>, and today I’m releasing version 1.0.</p><h3>The Problem with Current Options</h3><p>Flutter’s Text widget is beautifully simple - until you need formatting. Then you’re forced to choose between two painful paths.</p><p><strong>1. Manual TextSpan construction</strong></p><pre>Text.rich(<br>  TextSpan(<br>    children: [<br>      TextSpan(text: &#39;Hello &#39;),<br>      TextSpan(<br>        text: &#39;world&#39;,<br>        style: TextStyle(fontWeight: FontWeight.bold),<br>      ),<br>      TextSpan(text: &#39;!&#39;),<br>    ],<br>  ),<br>)</pre><p>Three children for “Hello world!” — and this is the simple case. Add links, nested formatting, and tap handlers, and your code becomes a maintenance nightmare.</p><p><strong>2. Full Markdown packages:</strong><br>These solve the syntax problem but bring their own baggage: dependencies, performance overhead, unfamiliar APIs, and configuration for features you’ll never touch.</p><p>Here’s what I realized: chat messages, comments, notifications, tooltips, product descriptions — they all need the same thing. Bold. Italic. Links. Maybe strikethrough or highlights.</p><p><strong>That’s it. No headers, no lists, no images. Just inline formatting.</strong></p><p>So I built a package that does exactly that.</p><h3>Introducing Textf</h3><p>Textf is a drop-in replacement for Flutter’s Text widget:</p><pre>// Before<br>Text(&#39;Hello world&#39;)<br><br>// After<br>Textf(&#39;Hello **world**&#39;)</pre><p>That’s the entire migration. Every parameter you know still works:</p><pre>Textf(<br>  &#39;Hello **Flutter**. ==Build for *any* screen!==&#39;,<br>  style: TextStyle(fontSize: 18),<br>  textAlign: TextAlign.center,<br>  maxLines: 2,<br>  overflow: TextOverflow.ellipsis,<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*oh7iza_xlNXoDWWQqCqRuw.png" /><figcaption>Rendered output showing formatted text.</figcaption></figure><blockquote>No new widget hierarchy. No configuration objects. <strong>Swap Text for Textf and start formatting.</strong></blockquote><h3>What You Can Do</h3><p><strong>Emphasis and Decoration</strong></p><pre>Textf(&#39;Make text **bold** or *italic* or ***both***.&#39;)<br>Textf(&#39;Mark as ~~deleted~~ or ++underlined++ or ==highlighted==.&#39;)<br>Textf(&#39;Show `inline code` for commands.&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*YD9HBSV-W6OApleqJdbbag.png" /><figcaption>All formatting styles rendered.</figcaption></figure><p><strong>Scientific Notation</strong><br>Superscript and subscript work without custom widgets:</p><pre>Textf(&#39;The formula is E = mc^2^&#39;)<br>Textf(&#39;Water is H~2~O&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*DcH1gGrpNoAf9WglczAgBw.png" /><figcaption>E=mc² and H₂O rendered.</figcaption></figure><p><strong>Interactive Links</strong><br>Links are tappable, not just styled. You can nest formatting inside links and customize hover states:</p><pre>TextfOptions(<br>  onLinkTap: (url, displayText) =&gt; launchUrl(Uri.parse(url)),<br>  child: Textf(&#39;Visit [**Flutter**](https://flutter.dev) to learn more.&#39;),<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*_dZlmDXrY3EoTpIFpzD6vQ.gif" /><figcaption>Link hover interaction.</figcaption></figure><p>Need literal asterisks? Escape them: <strong>Textf(r</strong>’<strong>Use \*asterisks\* literally</strong>’<strong>)</strong> renders as “Use *asterisks<em>*</em> literally”.</p><h3>Why Developers Choose Textf</h3><p><strong>1. Zero Dependencies, Familiar API</strong><br>Your pubspec.yaml adds one line:</p><pre>dependencies:<br>  textf: ^1.0.0</pre><p>No transitive packages. No version conflicts. And since <strong>every Text parameter works identically</strong> - style, textAlign, maxLines, overflow, textScaler, semanticsLabel - there’s nothing new to learn.</p><p><strong>2. Theme-Aware and Customizable</strong><br>Textf adapts to your app’s theme automatically. Links use colorScheme.primary. Code blocks use appropriate surface colors. Light and dark mode just work.</p><p>When you need control, TextfOptions provides full customization for every format type - but sensible defaults mean you rarely need it.</p><p><strong>3. Built for Production</strong></p><ul><li><strong>Performance:</strong> Text without formatting markers bypasses the tokenizer logic completely, falling back to a standard TextSpan instantly. Text with formatting uses a single-pass (Linear O(N)) parser optimized for real-world use.</li><li><strong>Error handling:</strong> Malformed input becomes plain text. Textf(‘**unclosed bold’) renders safely. Your app never crashes from a user’s typo.</li></ul><p><strong>4. Translator-Friendly</strong><br>This benefit surprised me with how much it matters. Your .arb translation files can include formatting directly:</p><pre>{<br>  &quot;welcomeMessage&quot;: &quot;Welcome to **Flutter**, the *beautiful* way to build apps!&quot;,<br>  &quot;errorMessage&quot;: &quot;**Oops!** Something went *wrong*. Please try again.&quot;<br>}</pre><p>Translators see the formatting inline. They understand <strong>bold</strong> without being developers. Compare this to splitting strings or asking translators to handle HTML tags.</p><h3>When to Use Textf (and when not to)</h3><p><strong>Perfect for:</strong></p><ul><li>Chat messages and comments</li><li>Notification text</li><li>Product descriptions</li><li>Help text and tooltips</li><li>UI labels with emphasis</li><li>Internationalized strings</li><li>Any inline-formatted content</li></ul><p><strong>Not designed for:</strong></p><ul><li>Full documents with headings and lists</li><li>Content with images or tables</li><li>Syntax-highlighted code blocks</li><li>Complex Markdown rendering</li></ul><p><strong>Limitations:</strong></p><ol><li><strong>Block Elements:</strong> It is not designed for full documents with headings and lists.</li><li><strong>Selection:</strong> Interactive links are rendered as inline widgets. Native text selection does not span across interactive links (you can select text <em>before</em> a link and <em>after</em> it, but not drag across it).</li></ol><h3>Get Started</h3><pre>dependencies:<br>  textf: ^1.0.0</pre><pre>import &#39;package:textf/textf.dart&#39;;<br><br>Textf(&#39;Hello **Flutter** developers!&#39;)</pre><p><strong>What’s Next</strong><br>In my next article, I’ll build real components with Textf — help tooltips, product cards, and more — covering custom styling, theme integration, and interactive links.</p><p>Until then:</p><p>📦 <strong>pub.dev:</strong> <a href="https://pub.dev/packages/textf">pub.dev/packages/textf</a><br>⭐ <strong>GitHub:</strong> <a href="https://github.com/PhilippHGerber/textf">github.com/PhilippHGerber/textf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d15f02dcfe3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>