You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
samples/asset_transformation/pubspec.yaml

42 lines
1.4 KiB

Add asset transformation sample (#2267) This adds a sample Flutter project that demonstrates a soon-to-be-released feature, asset transformation[^1]. [PR for flutter.dev documentation](https://github.com/flutter/website/pull/10471). This feature isn't the easiest to explain using documentation, so I think augmenting that documentation with a sample is appropriate. This sample demonstrates 1) how to use an existing Dart package (that is compatible with the feature) as an asset transformer and 2) how to write a Dart package that is compatible with this feature. This should be clear from the README.md. **Advice for reviewing this PR.** The goal here is that most users that read the documentation and follow the link from there to this sample should be able to figure out what the feature does and how to use it. Try to imagine yourself in this position and follow this story. If the feature is still unclear, then there is probably something we can do to improve this sample or the docs. Said more simply, follow these steps: 1) Start at the new section to be added to Flutter.dev (https://flutter-docs-prod--pr10471-document-asset-transformers-cc21qf01.web.app/ui/assets/assets-and-images#automatic-transformation-of-asset-files-at-build-time). It should naturally link you to the sample project. Start with the README and see if things make sense. ## Pre-launch Checklist - [X] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [X] I signed the [CLA]. - [X] I read the [Contributors Guide]. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/wiki/Chat [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md [^1]: If you are super curious about this feature, see [the tracking issue for its implementation](https://github.com/flutter/flutter/issues/143348). --------- Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2 months ago
name: asset_transformation
description: "A new Flutter project."
publish_to: 'none'
version: 0.1.0
environment:
sdk: ^3.4.0-0
Add asset transformation sample (#2267) This adds a sample Flutter project that demonstrates a soon-to-be-released feature, asset transformation[^1]. [PR for flutter.dev documentation](https://github.com/flutter/website/pull/10471). This feature isn't the easiest to explain using documentation, so I think augmenting that documentation with a sample is appropriate. This sample demonstrates 1) how to use an existing Dart package (that is compatible with the feature) as an asset transformer and 2) how to write a Dart package that is compatible with this feature. This should be clear from the README.md. **Advice for reviewing this PR.** The goal here is that most users that read the documentation and follow the link from there to this sample should be able to figure out what the feature does and how to use it. Try to imagine yourself in this position and follow this story. If the feature is still unclear, then there is probably something we can do to improve this sample or the docs. Said more simply, follow these steps: 1) Start at the new section to be added to Flutter.dev (https://flutter-docs-prod--pr10471-document-asset-transformers-cc21qf01.web.app/ui/assets/assets-and-images#automatic-transformation-of-asset-files-at-build-time). It should naturally link you to the sample project. Start with the README and see if things make sense. ## Pre-launch Checklist - [X] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [X] I signed the [CLA]. - [X] I read the [Contributors Guide]. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/wiki/Chat [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md [^1]: If you are super curious about this feature, see [the tracking issue for its implementation](https://github.com/flutter/flutter/issues/143348). --------- Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2 months ago
dependencies:
flutter:
sdk: flutter
vector_graphics: ^1.1.11+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
Add asset transformation sample (#2267) This adds a sample Flutter project that demonstrates a soon-to-be-released feature, asset transformation[^1]. [PR for flutter.dev documentation](https://github.com/flutter/website/pull/10471). This feature isn't the easiest to explain using documentation, so I think augmenting that documentation with a sample is appropriate. This sample demonstrates 1) how to use an existing Dart package (that is compatible with the feature) as an asset transformer and 2) how to write a Dart package that is compatible with this feature. This should be clear from the README.md. **Advice for reviewing this PR.** The goal here is that most users that read the documentation and follow the link from there to this sample should be able to figure out what the feature does and how to use it. Try to imagine yourself in this position and follow this story. If the feature is still unclear, then there is probably something we can do to improve this sample or the docs. Said more simply, follow these steps: 1) Start at the new section to be added to Flutter.dev (https://flutter-docs-prod--pr10471-document-asset-transformers-cc21qf01.web.app/ui/assets/assets-and-images#automatic-transformation-of-asset-files-at-build-time). It should naturally link you to the sample project. Start with the README and see if things make sense. ## Pre-launch Checklist - [X] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [X] I signed the [CLA]. - [X] I read the [Contributors Guide]. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-devrel channel on [Discord]. <!-- Links --> [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [Discord]: https://github.com/flutter/flutter/wiki/Chat [Contributors Guide]: https://github.com/flutter/samples/blob/main/CONTRIBUTING.md [^1]: If you are super curious about this feature, see [the tracking issue for its implementation](https://github.com/flutter/flutter/issues/143348). --------- Co-authored-by: Eric Windmill <eric@ericwindmill.com>
2 months ago
vector_graphics_compiler: ^1.1.11+1
grayscale_transformer:
path: ./grayscale_transformer
flutter:
uses-material-design: true
assets:
# Here, we specify that assets/colorful.jpg should be transformed using
# the grayscale_transformer package. If you look at the dev_dependencies
# section, you'll notice that grayscale_transformer is a local path dependency
# and thus the full code of the package can be found right here in this project.
- path: assets/colorful.jpg
transformers:
- package: grayscale_transformer
# Here, we have an SVG image that we want to display in our app. Flutter
# cannot render SVG images itself, but there are packages that can.
# The vector_graphics package is one such app that can quickly render SVGs,
# but only after they have been run through the vector_graphics_compiler
# package first. Instead of having to do this manually ourselves, we
# can simply specify vector_graphics_compiler as a transformer on this asset.
- path: assets/svg.svg
transformers:
- package: vector_graphics_compiler
# Run the application using `flutter run` to see how these assets get rendered.