-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
✨ Add package
to generated assets
#401
Changes from 10 commits
064c5ff
3c11a10
cc0cece
67f58e7
dd4337c
7e04eaf
bb180a8
4352ebf
1a59d65
fbad33b
e879ed1
ca1e1e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,8 @@ class $AssetsUnknownGen { | |
class ResAssets { | ||
ResAssets._(); | ||
|
||
static const String package = 'example_resources'; | ||
|
||
static const $AssetsImagesGen images = $AssetsImagesGen(); | ||
static const $AssetsUnknownGen unknown = $AssetsUnknownGen(); | ||
} | ||
|
@@ -64,6 +66,8 @@ class AssetGenImage { | |
|
||
final String _assetName; | ||
|
||
static const String package = 'example_resources'; | ||
|
||
Image image({ | ||
Key? key, | ||
AssetBundle? bundle, | ||
|
@@ -84,7 +88,7 @@ class AssetGenImage { | |
bool matchTextDirection = false, | ||
bool gaplessPlayback = false, | ||
bool isAntiAlias = false, | ||
String? package = 'example_resources', | ||
@deprecated String? package = package, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No deprecate message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because of a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah sorry you did explain that back in July. Sorry for asking again! I just tried again locally, and @Deprecated("short") String? package, or @Deprecated("really really really really really really really really really really really long ")
String? package, Ok, it's such a minor thing, it's not worth debugging more. But maybe off-topic, but is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So far it looks to be required because codes are generated when running runners and produced formatted files without calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, dart_style is used during the generating of the code. I noticed the version of dart_style listed in packages/core/pubspec.yaml is a year old, and the dart format being run in the GitHub actions seems a lot newer than that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's fine unless it released v3 then we'll need to manually bump it. |
||
FilterQuality filterQuality = FilterQuality.low, | ||
int? cacheWidth, | ||
int? cacheHeight, | ||
|
@@ -119,7 +123,7 @@ class AssetGenImage { | |
|
||
ImageProvider provider({ | ||
AssetBundle? bundle, | ||
String? package = 'example_resources', | ||
String? package = package, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing deprecate message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, thanks! |
||
}) { | ||
return AssetImage( | ||
_assetName, | ||
|
@@ -138,11 +142,14 @@ class SvgGenImage { | |
|
||
final String _assetName; | ||
|
||
static const String package = 'example_resources'; | ||
|
||
SvgPicture svg({ | ||
Key? key, | ||
bool matchTextDirection = false, | ||
AssetBundle? bundle, | ||
String? package = 'example_resources', | ||
@Deprecated('Do not use package for a package asset') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the deprecated message, what should the developer do instead? "Do not use" doesn't tell them what to do instead. @deprecated("Package is no longer needed as it now defaults to correct package") ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They should not use package for a package asset, which literally means not using it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah and it's |
||
String? package = package, | ||
double? width, | ||
double? height, | ||
BoxFit fit = BoxFit.contain, | ||
|
@@ -191,6 +198,8 @@ class FlareGenImage { | |
|
||
final String _assetName; | ||
|
||
static const String package = 'example_resources'; | ||
|
||
FlareActor flare({ | ||
String? boundsNode, | ||
String? animation, | ||
|
@@ -234,6 +243,8 @@ class RiveGenImage { | |
|
||
final String _assetName; | ||
|
||
static const String package = 'example_resources'; | ||
|
||
RiveAnimation rive({ | ||
String? artboard, | ||
List<String> animations = const [], | ||
|
@@ -269,6 +280,8 @@ class LottieGenImage { | |
|
||
final String _assetName; | ||
|
||
static const String package = 'example_resources'; | ||
|
||
LottieBuilder lottie({ | ||
Animation<double>? controller, | ||
bool? animate, | ||
|
@@ -287,7 +300,8 @@ class LottieGenImage { | |
double? height, | ||
BoxFit? fit, | ||
AlignmentGeometry? alignment, | ||
String? package = 'example_resources', | ||
@Deprecated('Do not use package for a package asset') | ||
String? package = package, | ||
bool? addRepaintBoundary, | ||
FilterQuality? filterQuality, | ||
void Function(String)? onWarning, | ||
|
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.
nit:
package_parameter_enabled
seems quite long, surelypackage_parameter
would also be acceptable?and in your example, would you set this to "true" to have the package parameter included?
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.
The parameter is not new, so it'd be a breaking change if we use another name.
Sure. Sounds good too.