# simple_html_css_flutter **Repository Path**: kurumi/simple_html_css_flutter ## Basic Information - **Project Name**: simple_html_css_flutter - **Description**: No description available - **Primary Language**: Dart - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-09 - **Last Updated**: 2024-07-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Simple Html CSS [](https://pub.dev/packages/simple_html_css) [](https://github.com/ali-thowfeek/simple_html_css_flutter/blob/master/LICENSE) This is a fork of [css_text_for_flutter](https://github.com/hathibelagal-dev/css_text_for_flutter) This package makes it easy for you to convert HTML with inline CSS content into `RichText` widgets. It supports most CSS properties that are relevant to **text** content, except for a few. Also gives the ability to override the styles of the content passed in. >NOTE: This is not an alternative to webview packages. This package only deals with text. Here's a sample HTML content with inline CSS styles: ```html
Lorem ipsum dolor sit, consectetur adipiscing elit. Pellentesque in leo id dui bibendum fringilla in et arcu. In vehicula vel est sed mattis.
We all spell recieve wrong.
Some times we
delete stuff
Some different FONT with this part highlighted
Hello World
"""; RichText( text: HTML.toTextSpan(context, htmlContent), maxLines: 4, //... ); ``` As a shortcut, you can also use the `HTML.toRichText()` method. ```dart var myRichText = HTML.toRichText(context, htmlContent); Container( child: myRichText, ); ``` ## Handling Links Your HTML content can have links. To handle them, you must use the `linksCallback` optional parameter. ```dart String htmlContent = """ Please click here or here.This has no font size css property, but global style will be applied
The inline color for this is orange, but it will get overridden by global style defined below """; HTML.toTextSpan( context, htmlContent, overrideStyle: { "p": TextStyle(fontSize: 17.3), "a": TextStyle(color: Colors.red), // specify any tag not just the supported ones, // and apply TextStyles to them and/override them }, ); ``` ## Supported HTML Tags Supports all tags which prints text normally like `p`, `div`, `span`, `body` etc. And the following special tags which change the text appearance * `