Flutter, how to save my workspace widget (which contains all other widgets) to be built and uploaded as a webpage

Viewed 6

I am building a website in flutter, similar to wix/squarespace, you can build web page. All the widgets that contribute to building the web page, is stored in my Workspace widget as a List. I am stuck on how to save the workspace widget so that it can built in future as a web page.

1 Answers

You need to create HTML elements with CSS from your widgets and store them in html and css files in a output folder.

Converting from widgets to html cannot be done easily.

You should start with createing a toHTML() method for each widget type you are using (maybe in an extension) and create an html tree by calling this method recursively from the root widget. I would create predefined css styles that these generated elements use that resemble the look that flutter provides.

Related