-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Document use of asset images in package dependencies. #663
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
Conversation
assets-and-images.md
Outdated
| - packages/fancy_backgrounds/backgrounds/background1.png | ||
| ``` | ||
|
|
||
| Note that the `lib/` is implied, so it should not be included in the asset path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid empty prose like "Note that", you can just start with "The".
|
@LarkAscending may wish to review also. |
|
Fixes flutter/flutter#9249 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few nits, otherwise looks great!
assets-and-images.md
Outdated
|
|
||
| ### Asset images in package dependencies | ||
|
|
||
| To load an image from a package dependency, the `package` argument must be provided to [`AssetImage`](https://docs.flutter.io/flutter/services/AssetImage-class.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe link package to https://flutter.io/using-packages/ which has a short intro to what packages are?
assets-and-images.md
Outdated
|
|
||
| If the desired asset is specified in the `pubspec.yaml` file of the package, it is bundled automatically with the application. In particular, assets used by the package itself must be specified in its `pubspec.yaml`. | ||
|
|
||
| A package can also choose to have assets in its `lib/` folder that are not specified in its `pubspec.yaml` file. In this case, for those images to be bundled, the application has to specify which ones to include. For instance, a package named `fancy_backgrounds` could have the following files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add 'in its pubspec.yaml' after 'which ones to include' ?
assets-and-images.md
Outdated
| * .../lib/backgrounds/background2.png | ||
| * .../lib/backgrounds/background3.png | ||
|
|
||
| To include, say the first image, the `pubspec.yaml` of the application should specify it in the `assets` section: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comma after 'say'
Update to reflect #11751 and flutter/website#663
Update to reflect #11751 and flutter/website#663
No description provided.