Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom-rendering iframe throws an error #241

Closed
Sub6Resources opened this issue Mar 5, 2020 · 5 comments
Closed

Custom-rendering iframe throws an error #241

Sub6Resources opened this issue Mar 5, 2020 · 5 comments

Comments

@Sub6Resources
Copy link
Owner

Thanks alot man. Have you also looked at this issue I pointed out?

          customRender: {
            'iframe': (
              RenderContext renderContext,
              Widget widget,
              children,
            ) {
              return Text(
                'iFRAME',
                style: TextStyle(
                    fontSize: 30,
                    color: Colors.red,
                    fontWeight: FontWeight.w900),
              );
            },
          },
        ),

This throws an error: The getter 'attributes' was called on null.

It only happens when you try to customRender an iframe.

Originally posted by @shamnex in #64 (comment)

@fadhlisulaimi
Copy link

I have this issue as well for 1.0.0

@fadhlisulaimi
Copy link

Managed to solve this by using my own widget. In my case, I have created my own custom youtube player widget for iFrame.

Go to replaced_element.dart file, then in IframeContentElement class (line 171) override the toWidget method and return your own widget.

@wxcvbn612
Copy link

any solution for this problem??

@DFelten
Copy link
Contributor

DFelten commented Aug 2, 2020

The Issue is still there. The problem occurs since there are no attributes for an iframe detected in styled_element.dart line 28:

Map<String, String> get attributes => _node.attributes.map((key, value)

The error is gone when setting node and attribute optional (_node?.attributes?.map), but of course then there are no attributes in the customRenderer. My current solution is to change the iframe tag via replace with a custom tag. Then it's possible to replace the content of the iframe with a custom YouTube player or something else.

@erickok
Copy link
Collaborator

erickok commented Feb 8, 2021

Fixed by #500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants