· Designer & Developer at mts.la

Custom Widget: Render HTML Text(Wordpress)

For those of you who connect flutterflow to Wordpress REST-API. One of thing is to render HTML from wordpress content. Now it's possbile with Custom widget.


First you need to set Parameter  width and height  type Dimentions text type String > false color type Color > false Then we need this Pubspec Dependencies. And here is the code. And then save and enjoy!! 

 import 'package:flutter_html/flutter_html.dart';
class CustomHTML extends StatefulWidget {
  const CustomHTML({
    Key key,
    this.width,
    this.height,
    this.text,
    this.color,
  }) : super(key: key);

  final double width;
  final double height;
  final String text;
  final Color color;

  @override
  _CustomHTMLState createState() => _CustomHTMLState();
}

class _CustomHTMLState extends State {
  @override
  Widget build(BuildContext context) {
    return Container(
        width: widget.width,
        height: widget.height,
        decoration: BoxDecoration(
          color: widget.color,
        ),
        child: Padding(
          padding: EdgeInsetsDirectional.fromSTEB(15, 15, 15, 15),
          child: Html(data: widget.text),
        ));
  }
}  
2
6 replies