Flutter generate image from widget

Viewed 88

Let's say my data model is like

MyModel
------------
string Title 
string Body
string Remark

I have a list view in my flutter app to show the list of myModel.
In each of my list items, I have a button, when I press this button, I will pass the current myModel to a new function that will generate the image.

generateImage(MyModel model) {
  Widget imageToGenerate = Container(
      padding: const EdgeInsets.only(top: 30, bottom: 40),
      child: Center(child: Text(model.Title)));
}

In the function above, I can modify the style of my image as I want.
How can I generate an image from this widget?
I've found some references that are using currentContext.findRenderObject() but I don't know where to use it.

0 Answers
Related