Skip to content

[Web] Please support a custom stylesheet for platform views #67740

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

Closed
sma opened this issue Oct 9, 2020 · 3 comments
Closed

[Web] Please support a custom stylesheet for platform views #67740

sma opened this issue Oct 9, 2020 · 3 comments
Assignees
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter e: web_html HTML rendering backend for Web P3 Issues that are less important to the Flutter project platform-web Web applications specifically

Comments

@sma
Copy link

sma commented Oct 9, 2020

Flutter Web encapsulates all HTML created via HtmlElementView in a shadow DOM of a custom flt-platform-view element. The shadow DOM automatically get a style reset attached before the HTML element is added. This makes external customization of the HTML very difficult if not impossible. This is by design, I guess, but I'd like to globally customize the styles via an external .css file and not use inline styles for my HTML in each and every HtmlElementView.

Therefore, please support overwriting the all: initial style reset with a different style definition. An easy way would be to pass with ShadowRoot via getCreatedView to the callback, so that I can remove the reset and add my own style elements.

@darshankawar darshankawar added platform-web Web applications specifically c: proposal A detailed proposal for a change to Flutter e: web_html HTML rendering backend for Web passed first triage labels Oct 12, 2020
@yjbanov yjbanov added the assigned for triage issue is assigned to a domain expert for further triage label Oct 15, 2020
@ditman
Copy link
Member

ditman commented Oct 16, 2020

We're doing some work to make the Shadow DOM optional; this is a good new feature to add to that work. Let's link this two issues together:

#50452

(Also see this comment on a way you might be able to append a style tag within the ShadowDOM)

@ditman ditman added c: new feature Nothing broken; request for a new capability P3 Issues that are less important to the Flutter project and removed assigned for triage issue is assigned to a domain expert for further triage labels Oct 16, 2020
@ditman ditman removed their assignment Oct 16, 2020
@ditman
Copy link
Member

ditman commented Dec 22, 2022

Platform views now live OUTSIDE the shadow DOM, so they can be styled with standard CSS in the index.html of one's app. This shouldn't be an issue any longer.

Closing, but feel free to reopen if there's still trouble with this!

@ditman ditman closed this as completed Dec 22, 2022
@ditman ditman self-assigned this Dec 22, 2022
@github-actions
Copy link

github-actions bot commented Mar 4, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter e: web_html HTML rendering backend for Web P3 Issues that are less important to the Flutter project platform-web Web applications specifically
Projects
None yet
Development

No branches or pull requests

4 participants