Skip to content

Commit 5fab8ca

Browse files
authored
release: v5.6.0 (#534)
## 5.6.0 **Bug fix** - [#530](#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](#532) Provid the theme to SvgAssetLoader instead of SvgPicture. by [@Kirpal](https://github.com/Kirpal)
1 parent 4bf4cdc commit 5fab8ca

File tree

10 files changed

+64
-23
lines changed

10 files changed

+64
-23
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 5.6.0
2+
3+
**Bug fix**
4+
- [#530](https://github.com/FlutterGen/flutter_gen/pull/530) Fix the Flavored assets. by [@AlexV525](https://github.com/AlexV525)
5+
- 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.
6+
- [#532](https://github.com/FlutterGen/flutter_gen/pull/532) Provid the theme to SvgAssetLoader instead of SvgPicture. by [@Kirpal](https://github.com/Kirpal)
7+
18
## 5.5.0+1
29

310
**Feature**

examples/example/lib/main.dart

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ void main() async {
1010
// options: DefaultFirebaseOptions.currentPlatform,
1111
// );
1212

13+
// flavors sample
14+
// output: {'extern'}
15+
print(MyAssets.images.chip4.chip4.flavors);
16+
1317
runApp(MaterialApp(
1418
title: 'Flutter Demo',
1519
theme: ThemeData(

examples/example/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ dependencies:
2121
dev_dependencies:
2222
lints: ^2.0.0
2323
build_runner: ^2.0.0
24-
flutter_gen_runner: ^5.5.0+1
24+
flutter_gen_runner: ^5.6.0
2525
flutter_test:
2626
sdk: flutter
2727

examples/example_resources/lib/gen/assets.gen.dart

+44-14
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,18 @@ class ResAssets {
6363
}
6464

6565
class AssetGenImage {
66-
const AssetGenImage(this._assetName, {this.size = null});
66+
const AssetGenImage(
67+
this._assetName, {
68+
this.size,
69+
this.flavors = const {},
70+
});
6771

6872
final String _assetName;
6973

7074
static const String package = 'example_resources';
7175

7276
final Size? size;
77+
final Set<String> flavors;
7378

7479
Image image({
7580
Key? key,
@@ -145,21 +150,23 @@ class AssetGenImage {
145150
class SvgGenImage {
146151
const SvgGenImage(
147152
this._assetName, {
148-
this.size = null,
153+
this.size,
154+
this.flavors = const {},
149155
}) : _isVecFormat = false;
150156

151157
const SvgGenImage.vec(
152158
this._assetName, {
153-
this.size = null,
159+
this.size,
160+
this.flavors = const {},
154161
}) : _isVecFormat = true;
155162

156163
final String _assetName;
157-
158-
static const String package = 'example_resources';
159-
160164
final Size? size;
165+
final Set<String> flavors;
161166
final bool _isVecFormat;
162167

168+
static const String package = 'example_resources';
169+
163170
SvgPicture svg({
164171
Key? key,
165172
bool matchTextDirection = false,
@@ -181,12 +188,23 @@ class SvgGenImage {
181188
@deprecated BlendMode colorBlendMode = BlendMode.srcIn,
182189
@deprecated bool cacheColorFilter = false,
183190
}) {
191+
final BytesLoader loader;
192+
if (_isVecFormat) {
193+
loader = AssetBytesLoader(
194+
_assetName,
195+
assetBundle: bundle,
196+
packageName: package,
197+
);
198+
} else {
199+
loader = SvgAssetLoader(
200+
_assetName,
201+
assetBundle: bundle,
202+
packageName: package,
203+
theme: theme,
204+
);
205+
}
184206
return SvgPicture(
185-
_isVecFormat
186-
? AssetBytesLoader(_assetName,
187-
assetBundle: bundle, packageName: package)
188-
: SvgAssetLoader(_assetName,
189-
assetBundle: bundle, packageName: package, theme: theme),
207+
loader,
190208
key: key,
191209
matchTextDirection: matchTextDirection,
192210
width: width,
@@ -210,9 +228,13 @@ class SvgGenImage {
210228
}
211229

212230
class FlareGenImage {
213-
const FlareGenImage(this._assetName);
231+
const FlareGenImage(
232+
this._assetName, {
233+
this.flavors = const {},
234+
});
214235

215236
final String _assetName;
237+
final Set<String> flavors;
216238

217239
static const String package = 'example_resources';
218240

@@ -255,9 +277,13 @@ class FlareGenImage {
255277
}
256278

257279
class RiveGenImage {
258-
const RiveGenImage(this._assetName);
280+
const RiveGenImage(
281+
this._assetName, {
282+
this.flavors = const {},
283+
});
259284

260285
final String _assetName;
286+
final Set<String> flavors;
261287

262288
static const String package = 'example_resources';
263289

@@ -294,9 +320,13 @@ class RiveGenImage {
294320
}
295321

296322
class LottieGenImage {
297-
const LottieGenImage(this._assetName);
323+
const LottieGenImage(
324+
this._assetName, {
325+
this.flavors = const {},
326+
});
298327

299328
final String _assetName;
329+
final Set<String> flavors;
300330

301331
static const String package = 'example_resources';
302332

examples/example_resources/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717

1818
dev_dependencies:
1919
build_runner: ^2.0.0
20-
flutter_gen_runner: ^5.5.0+1
20+
flutter_gen_runner: ^5.6.0
2121

2222
flutter_gen:
2323
output: lib/gen/

packages/command/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_gen
22
description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
3-
version: 5.5.0+1
3+
version: 5.6.0
44
homepage: https://github.com/FlutterGen/flutter_gen
55
repository: https://github.com/FlutterGen/flutter_gen
66
documentation: https://github.com/FlutterGen/flutter_gen
@@ -13,7 +13,7 @@ executables:
1313
fluttergen: flutter_gen_command
1414

1515
dependencies:
16-
flutter_gen_core: 5.5.0+1
16+
flutter_gen_core: 5.6.0
1717
args: ^2.0.0
1818

1919
dev_dependencies:

packages/core/lib/settings/pubspec.g.dart

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/lib/version.gen.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/// DO NOT MODIFY BY HAND, Generated by version_gen
2-
String packageVersion = '5.5.0+1';
2+
String packageVersion = '5.6.0';

packages/core/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_gen_core
22
description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
3-
version: 5.5.0+1
3+
version: 5.6.0
44
homepage: https://github.com/FlutterGen/flutter_gen
55
repository: https://github.com/FlutterGen/flutter_gen
66
documentation: https://github.com/FlutterGen/flutter_gen

packages/runner/pubspec.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_gen_runner
22
description: The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
3-
version: 5.5.0+1
3+
version: 5.6.0
44
homepage: https://github.com/FlutterGen/flutter_gen
55
repository: https://github.com/FlutterGen/flutter_gen
66
documentation: https://github.com/FlutterGen/flutter_gen
@@ -10,7 +10,7 @@ environment:
1010
sdk: '>=2.17.0 <4.0.0'
1111

1212
dependencies:
13-
flutter_gen_core: 5.5.0+1
13+
flutter_gen_core: 5.6.0
1414
build: ^2.0.0
1515
collection: ^1.17.0
1616
crypto: ^3.0.0

0 commit comments

Comments
 (0)