File tree Expand file tree Collapse file tree 4 files changed +62
-106
lines changed
packages/core/lib/settings Expand file tree Collapse file tree 4 files changed +62
-106
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ $ fluttergen -c example/pubspec.yaml
109109## Configuration file
110110
111111[ FlutterGen] generates dart files based on the key ** ` flutter ` ** and ** ` flutter_gen ` ** of [ ` pubspec.yaml ` ] ( https://dart.dev/tools/pub/pubspec ) .
112- Default configuration can be found [ here] ( #default-configuration ) .
112+ Default configuration can be found [ here] ( https://github.com/FlutterGen/flutter_gen/tree/main/packages/core/lib/settings/config_default.dart ) .
113113
114114``` yaml
115115# pubspec.yaml
@@ -714,68 +714,6 @@ class ColorName {
714714</p>
715715</details>
716716
717- # ## Default Configuration
718-
719- The following are the default settings.
720- The options you set in `pubspec.yaml` will override the corresponding default options.
721-
722- ` ` ` yaml
723- flutter_gen:
724- # Optional
725- output: lib/gen/
726- # Optional
727- line_length: 80
728-
729- # Optional
730- integrations:
731- flutter_svg: false
732- flare_flutter: false
733- rive: false
734- lottie: false
735-
736- assets:
737- # Optional
738- enabled: true
739- # Optional
740- outputs:
741- # Optional
742- # Set to true if you want this package to be a package dependency
743- # See: https://flutter.dev/docs/development/ui/assets-and-images#from-packages
744- package_parameter_enabled: false
745- # Optional
746- # Avaliable values:
747- # - camel-case
748- # - snake-case
749- # - dot-delimiter
750- style: dot-delimiter
751- # Default is Assets
752- class_name: MyAssets
753-
754- fonts:
755- # Optional
756- enabled: true
757- # Optional
758- outputs:
759- # Default is FontFamily
760- class_name: MyFontFamily
761-
762- colors:
763- # Optional
764- enabled: true
765- # Optional
766- inputs: []
767- # Optional
768- outputs:
769- # Default is ColorName
770- class_name: MyColorName
771-
772- flutter:
773- # See: https://flutter.dev/docs/development/ui/assets-and-images#specifying-assets
774- assets: []
775- # See: https://flutter.dev/docs/cookbook/design/fonts#2-declare-the-font-in-the-pubspec
776- fonts: []
777- ` ` `
778-
779717# # Credits
780718
781719The material color generation implementation is based on [mcg](https://github.com/mbitson/mcg) and [TinyColor](https://github.com/bgrins/TinyColor).
Original file line number Diff line number Diff line change 11import 'dart:io' ;
22
3- import 'package:flutter_gen_core/utils/error.dart' ;
4- import 'package:flutter_gen_core/utils/version.dart' ;
3+ import 'package:flutter_gen_core/settings/config_default.dart' ;
54import 'package:path/path.dart' ;
65import 'package:yaml/yaml.dart' ;
76
7+ import '../utils/error.dart' ;
88import '../utils/map.dart' ;
9+ import '../utils/version.dart' ;
910import 'pubspec.dart' ;
1011
1112class Config {
@@ -23,7 +24,7 @@ Config loadPubspecConfig(File pubspecFile) {
2324 ))}' );
2425 final content = pubspecFile.readAsStringSync ();
2526 final userMap = loadYaml (content) as Map ? ;
26- final defaultMap = loadYaml (_defaultConfig ) as Map ? ;
27+ final defaultMap = loadYaml (configDefaultYamlContent ) as Map ? ;
2728 final mergedMap = mergeMap ([defaultMap, userMap]);
2829 final pubspec = Pubspec .fromJson (mergedMap);
2930 return Config ._(pubspec: pubspec, pubspecFile: pubspecFile);
@@ -39,40 +40,3 @@ Config? loadPubspecConfigOrNull(File pubspecFile) {
3940 }
4041 return null ;
4142}
42-
43- const _defaultConfig = '''
44- name: $invalidStringValue
45-
46- flutter_gen:
47- output: lib/gen/
48- line_length: 80
49-
50- integrations:
51- flutter_svg: false
52- flare_flutter: false
53- rive: false
54- lottie: false
55-
56- assets:
57- enabled: true
58- outputs:
59- class_name: Assets
60- package_parameter_enabled: false
61- style: dot-delimiter
62- exclude: []
63-
64- fonts:
65- enabled: true
66- outputs:
67- class_name: FontFamily
68-
69- colors:
70- enabled: true
71- inputs: []
72- outputs:
73- class_name: ColorName
74-
75- flutter:
76- assets: []
77- fonts: []
78- ''' ;
Original file line number Diff line number Diff line change 1+ const configDefaultYamlContent = '''
2+ name: UNKNOWN
3+
4+ flutter_gen:
5+ # Optional
6+ output: lib/gen/
7+ # Optional
8+ line_length: 80
9+
10+ # Optional
11+ integrations:
12+ flutter_svg: false
13+ flare_flutter: false
14+ rive: false
15+ lottie: false
16+
17+ assets:
18+ # Optional
19+ enabled: true
20+ # Optional
21+ outputs:
22+ # Optional
23+ # Set to true if you want this package to be a package dependency
24+ # See: https://flutter.dev/docs/development/ui/assets-and-images#from-packages
25+ package_parameter_enabled: false
26+ # Optional
27+ # Available values:
28+ # - camel-case
29+ # - snake-case
30+ # - dot-delimiter
31+ style: dot-delimiter
32+ class_name: Assets
33+ exclude: []
34+
35+ fonts:
36+ # Optional
37+ enabled: true
38+ # Optional
39+ outputs:
40+ class_name: FontFamily
41+
42+ colors:
43+ # Optional
44+ enabled: true
45+ # Optional
46+ inputs: []
47+ # Optional
48+ outputs:
49+ class_name: ColorName
50+
51+ flutter:
52+ # See: https://flutter.dev/docs/development/ui/assets-and-images#specifying-assets
53+ assets: []
54+ # See: https://flutter.dev/docs/cookbook/design/fonts#2-declare-the-font-in-the-pubspec
55+ fonts: []
56+ ''' ;
Original file line number Diff line number Diff line change @@ -2,9 +2,7 @@ import 'package:json_annotation/json_annotation.dart';
22
33part 'pubspec.g.dart' ;
44
5- /// Edit this file, then run `make generate-config-model`
6-
7- const invalidStringValue = 'FLUTTER_GEN_INVALID' ;
5+ // NOTE: Run `melos gen:build_runner` after editing this file
86
97@JsonSerializable ()
108class Pubspec {
You can’t perform that action at this time.
0 commit comments