css_text
3.0.0, released 3 years ago by an unverified publisher
Convert HTML with inline CSS into Flutter RichText widgets.
What it does
The package parses HTML strings and CSS style attributes, building a TextSpan hierarchy that Flutter can render as RichText. It supports most text‑related CSS properties and link callbacks.
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display simple styled HTML content without a full web view
- You want lightweight inline‑style support for text in a Flutter app
Skip it when
- Complex layouts or CSS features beyond text styling are required
- You need full CSS layout, animations, or JavaScript support
Strengths
- Lightweight and pure Dart implementation
- Null‑safe and compatible with Dart 3
- Easy link handling via callback
Weaknesses
- Limited to text‑related CSS, no alignment or block layout support
- No built‑in image handling
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:css_text/css_text.dart';
String html = '''<p style="font-size:1.5em;color:#99ff0011">Hello <b>World</b></p>''';
var rich = RichText(text: HTML.toTextSpan(context, html));Alternatives
Packages that do the same job and could replace css_text.
- simple_html_css
Convert simple HTML and inline CSS styles into RichText or TextSpan widgets.
50Compare - textf
Drop-in Text and TextEditingController replacements for inline Markdown-like text formatting
81Compare - flutter_markdown_plus
A Markdown renderer widget for Flutter to display rich text from plain text data.
77Compare - re_editor
A lightweight text and code editor widget for Flutter with syntax highlighting and folding.
80Compare
Works with
Packages commonly used together with css_text: ones it builds on, ones built on it, and its own family.