Skip to content
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

release: v5.6.0 #534

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 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.
- [#532](https://github.com/FlutterGen/flutter_gen/pull/532) Provid the theme to SvgAssetLoader instead of SvgPicture. by [@Kirpal](https://github.com/Kirpal)

## 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
2 changes: 1 addition & 1 deletion examples/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
dev_dependencies:
lints: ^2.0.0
build_runner: ^2.0.0
flutter_gen_runner: ^5.5.0+1
flutter_gen_runner: ^5.6.0
flutter_test:
sdk: flutter

Expand Down
58 changes: 44 additions & 14 deletions examples/example_resources/lib/gen/assets.gen.dart
wasabeef marked this conversation as resolved.
Show resolved Hide resolved
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
2 changes: 1 addition & 1 deletion examples/example_resources/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:

dev_dependencies:
build_runner: ^2.0.0
flutter_gen_runner: ^5.5.0+1
flutter_gen_runner: ^5.6.0

flutter_gen:
output: lib/gen/
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
Loading