Closed wasabeef closed 4 months ago
@wasabeef please merge this if it's correct. It's really needed.
Is it possible to generate all assets without specifying many paths - it gets complicated when you have many assets nested in multiple folders in your assets/
directory
Is it possible? Please help if it could be.
Is it possible to generate all assets without specifying many paths - it gets complicated when you have many assets nested in multiple folders in your
assets/
directory
Any updates?
Any updates?
Already done as I see - https://github.com/FlutterGen/flutter_gen/pull/276#issuecomment-1221519836
But I can't make it work..
I need to exclude fonts from generation, but it's not working. I tried
flutter_gen:
output: lib/theme/asset
line_length: 80
integrations:
flutter_intl: false
flutter_svg: true
assets:
enabled: true
output:
style: dot-delimiter
package_parameter_enabled: false
fonts:
enabled: false
and
flutter_gen:
output: lib/theme/asset
line_length: 80
integrations:
flutter_intl: false
flutter_svg: true
assets:
enabled: true
exclude:
- assets/font/
output:
style: dot-delimiter
package_parameter_enabled: false
The same result. What's wrong?
Part of generated file
...
class $AssetsFontRobotoGen {
const $AssetsFontRobotoGen();
/// File path: assets/font/Roboto/LICENSE.txt
String get license => 'assets/font/Roboto/LICENSE.txt';
/// File path: assets/font/Roboto/Roboto-Black.ttf
String get robotoBlack => 'assets/font/Roboto/Roboto-Black.ttf';
/// File path: assets/font/Roboto/Roboto-BlackItalic.ttf
String get robotoBlackItalic => 'assets/font/Roboto/Roboto-BlackItalic.ttf';
...
Flutter 3.19.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision ba39319843 (2 weeks ago) • 2024-03-07 15:22:21 -0600 Engine • revision 2e4ba9c6fb Tools • Dart 3.3.1 • DevTools 2.31.1
flutter_gen_runner: ^5.4.0
@AlexSeednov It is likely that you've put assets/font/
in your assets list. Remove them and your result will be as you desired.
@AlexSeednov It is likely that you've put
assets/font/
in your assets list. Remove them and your result will be as you desired.
Maybe, but I need to include this font in assets
Using those fonts in your application does not require you to write them in the assets list. Example: https://github.com/FlutterGen/flutter_gen/blob/584648dfdcb16fcfc937004e142201340518a9db/examples/example/pubspec.yaml#L74-L92
You're right, using font section near assets section is solving the problem, thanks. But using assets sections is much easier - as said here https://pub.dev/packages/google_fonts#bundling-fonts-when-releasing
@AlexSeednov See https://github.com/FlutterGen/flutter_gen/issues/509#issuecomment-2169090864 and #529.
Please consider the following use-case:
All files inside the data folder are simple data files, for example json or xml files. Which are used internally in the flutter application and therefore should not be considered as layout files (images, color, fonts etc.).
It would be great to have an
exclude:
property to defines those files or directories._Originally posted by @jayjah in https://github.com/FlutterGen/flutter_gen/issues/132#issuecomment-986102743_