flutter_html icon indicating copy to clipboard operation
flutter_html copied to clipboard

How to use ImageExtension ?

Open zxl777 opened this issue 1 year ago • 3 comments

I previously added rounded corners to <img> tags in an older version of flutter_html, but how should I achieve the same effect with the new ImageExtension?

                    customRender: {
                      'img': (context, child) {
                        return ClipRRect(
                          borderRadius: BorderRadius.circular(5.0),
                          child: (context.tree as ImageContentElement).toWidget(context),
                        );
                      }
                    }

zxl777 avatar Jan 23 '24 20:01 zxl777

Try this:

 ImageExtension(
     builder: (extensionContext) {
          final element = extensionContext.styledElement as ImageElement;
             
          return ClipRRect(
              borderRadius: BorderRadius.circular(5.0),                         
              child: Image.network(
                  element.src,
                ),
              );
            },
          ),

azeunkn0wn avatar May 04 '24 01:05 azeunkn0wn

In current 3.0.0-beta.2 ImageElement is not defined for me. What is the current status of img tag?

leeparayno avatar Jul 15 '24 13:07 leeparayno