Skip to content

Commit

Permalink
release: v5.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabeef committed Jun 25, 2024
1 parent 4bf4cdc commit 4f7ea9d
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 5.6.0

**Bug fix**
- [#530](https://github.com/FlutterGen/flutter_gen/pull/530) Fix the Flavored assets. by [@AlexV525](https://github.com/AlexV525)
- Please submit issues later if you have any feedback, this is blocking users from generating files if they are using flavors or transformations and there is no workaround for them.

## 5.5.0+1

**Feature**
Expand Down
4 changes: 4 additions & 0 deletions examples/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ void main() async {
// options: DefaultFirebaseOptions.currentPlatform,
// );

// flavors sample
// output: {'extern'}
print(MyAssets.images.chip4.chip4.flavors);

runApp(MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
Expand Down
58 changes: 44 additions & 14 deletions examples/example_resources/lib/gen/assets.gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,18 @@ class ResAssets {
}

class AssetGenImage {
const AssetGenImage(this._assetName, {this.size = null});
const AssetGenImage(
this._assetName, {
this.size,
this.flavors = const {},
});

final String _assetName;

static const String package = 'example_resources';

final Size? size;
final Set<String> flavors;

Image image({
Key? key,
Expand Down Expand Up @@ -145,21 +150,23 @@ class AssetGenImage {
class SvgGenImage {
const SvgGenImage(
this._assetName, {
this.size = null,
this.size,
this.flavors = const {},
}) : _isVecFormat = false;

const SvgGenImage.vec(
this._assetName, {
this.size = null,
this.size,
this.flavors = const {},
}) : _isVecFormat = true;

final String _assetName;

static const String package = 'example_resources';

final Size? size;
final Set<String> flavors;
final bool _isVecFormat;

static const String package = 'example_resources';

SvgPicture svg({
Key? key,
bool matchTextDirection = false,
Expand All @@ -181,12 +188,23 @@ class SvgGenImage {
@deprecated BlendMode colorBlendMode = BlendMode.srcIn,
@deprecated bool cacheColorFilter = false,
}) {
final BytesLoader loader;
if (_isVecFormat) {
loader = AssetBytesLoader(
_assetName,
assetBundle: bundle,
packageName: package,
);
} else {
loader = SvgAssetLoader(
_assetName,
assetBundle: bundle,
packageName: package,
theme: theme,
);
}
return SvgPicture(
_isVecFormat
? AssetBytesLoader(_assetName,
assetBundle: bundle, packageName: package)
: SvgAssetLoader(_assetName,
assetBundle: bundle, packageName: package, theme: theme),
loader,
key: key,
matchTextDirection: matchTextDirection,
width: width,
Expand All @@ -210,9 +228,13 @@ class SvgGenImage {
}

class FlareGenImage {
const FlareGenImage(this._assetName);
const FlareGenImage(
this._assetName, {
this.flavors = const {},
});

final String _assetName;
final Set<String> flavors;

static const String package = 'example_resources';

Expand Down Expand Up @@ -255,9 +277,13 @@ class FlareGenImage {
}

class RiveGenImage {
const RiveGenImage(this._assetName);
const RiveGenImage(
this._assetName, {
this.flavors = const {},
});

final String _assetName;
final Set<String> flavors;

static const String package = 'example_resources';

Expand Down Expand Up @@ -294,9 +320,13 @@ class RiveGenImage {
}

class LottieGenImage {
const LottieGenImage(this._assetName);
const LottieGenImage(
this._assetName, {
this.flavors = const {},
});

final String _assetName;
final Set<String> flavors;

static const String package = 'example_resources';

Expand Down
4 changes: 2 additions & 2 deletions packages/command/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_gen
description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
version: 5.5.0+1
version: 5.6.0
homepage: https://github.com/FlutterGen/flutter_gen
repository: https://github.com/FlutterGen/flutter_gen
documentation: https://github.com/FlutterGen/flutter_gen
Expand All @@ -13,7 +13,7 @@ executables:
fluttergen: flutter_gen_command

dependencies:
flutter_gen_core: 5.5.0+1
flutter_gen_core: 5.6.0
args: ^2.0.0

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/settings/pubspec.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/lib/version.gen.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/// DO NOT MODIFY BY HAND, Generated by version_gen
String packageVersion = '5.5.0+1';
String packageVersion = '5.6.0';
2 changes: 1 addition & 1 deletion packages/core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_gen_core
description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
version: 5.5.0+1
version: 5.6.0
homepage: https://github.com/FlutterGen/flutter_gen
repository: https://github.com/FlutterGen/flutter_gen
documentation: https://github.com/FlutterGen/flutter_gen
Expand Down
4 changes: 2 additions & 2 deletions packages/runner/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_gen_runner
description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
version: 5.5.0+1
version: 5.6.0
homepage: https://github.com/FlutterGen/flutter_gen
repository: https://github.com/FlutterGen/flutter_gen
documentation: https://github.com/FlutterGen/flutter_gen
Expand All @@ -10,7 +10,7 @@ environment:
sdk: '>=2.17.0 <4.0.0'

dependencies:
flutter_gen_core: 5.5.0+1
flutter_gen_core: 5.6.0
build: ^2.0.0
collection: ^1.17.0
crypto: ^3.0.0
Expand Down

0 comments on commit 4f7ea9d

Please sign in to comment.