You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Example code for adding an image doesn't actually show the image #9901
After pasting the example code from the "Loading images" section into my app, the app didn't actually show an image (I think I now understand why that is). It might be more useful/satisfying to include code in the example that actually shows the image when copied to get people started quicker. I ended up using new Image.asset('assets/sunset.jpg') to verify that the image would actually load in my app.
Perhaps if the assets-and-images section pointed at a small working "sample app" in addition to providing code fragments, you'd have had less trouble (#9912).
Talking w/ @goderbauer root cause is the parent of the Image widget needs to actually have a size in order to display the image. So the code snippet for the build() method needs to include a parent-with-size.
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.
Activity
goderbauer commentedon May 8, 2017
This is what my
buildmethod looks like:HansMuller commentedon May 9, 2017
Perhaps if the assets-and-images section pointed at a small working "sample app" in addition to providing code fragments, you'd have had less trouble (#9912).
LarkAscending commentedon Jun 3, 2017
Talking w/ @goderbauer root cause is the parent of the Image widget needs to actually have a size in order to display the image. So the code snippet for the build() method needs to include a parent-with-size.
Hixie commentedon Jun 4, 2017
The
Imagewidget should size itself to the size of the image by default.zoechi commentedon Dec 3, 2018
Issue moved to flutter/website #1826 via ZenHub
github-actions commentedon Sep 1, 2021
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 -vand a minimal reproduction of the issue.