HTML to Flutter Widget Package

This package allows you to convert HTML content into Flutter widgets, enabling you to seamlessly integrate HTML-rendered elements within your Flutter applications.

Supported Platform

  • Android
  • iOS
  • Web
  • Windows

Screen Shoot

Web

Features

  • Render HTML content as Flutter widgets
  • Support for images and videos
  • More features coming soon

Getting Started

To start using this package, ensure you have the following prerequisites:

Requirements

  • A basic Flutter project

You can begin by adding the package to your pubspec.yaml file and following the setup instructions.

Usage

dependencies:
  edmax_html_renderer_lite: x.x.x

Here’s a basic example of how to use the package:

import 'package:edmax_html_renderer_lite/edmax_html_renderer_lite.dart';

Widget example() {
  final String htmlContent = """
  <p style="color:${toHTMLColor(Colors.green)}">[PARAGRAPHS]</p>
  <p style="font-size:10px; color:${toHTMLColor(Colors.blue)};">Text 1</p>
  <p style="font-size:10px; font-style:italic">Text 2</p>
  <p style="font-style:bold;">Text 3</p>
  <p style="color:${toHTMLColor(Colors.green)}">[STRONG & BOLD]</p>
  <strong>Strong</strong>
  <b>Bold</b>
  <p style="color:${toHTMLColor(Colors.green)}">[IMAGE]</p>
  <img width=300 src="https://th.bing.com/th/id/R.d7e789c3b8bcb2b7880dd3b4b1d3edd6?rik=rPeAx6Ckk8%2b4Qg&pid=ImgRaw&r=0"/>
  <br><br><br><br><br>
  <p style="color:${toHTMLColor(Colors.green)}">[VIDEO]</p>
  <video width=300 id="vid-b" src="https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4"></video>
  """;
  return RenderHTML(htmlContent: htmlContent, buildContext: context);
}

Defining HTML Colors

To define HTML colors, you can use the following function:

final String htmlContent = """<p style="color:${toHTMLColor(Colors.green)}">Hello world</p>""";
RenderHTML(htmlContent: htmlContent, buildContext: context);

Supported Tags

<p>
<strong>
<b>
<img>
<br>
<video>

Supported Styling

font-size
font-style
color
width
height

For more details about this package, including how to contribute, file issues, or get support:

DEMO