forked from Norbert515/flutter_ide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.dart
51 lines (33 loc) · 1.66 KB
/
build.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'dart:io';
import 'package:package_config/packages_file.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/properties/parser/models.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/widgets/generators/widget_generator.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/widgets/parser.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/properties/build_property.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/properties/parser/parser.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/widgets/generators/build_widget.dart';
import 'package:widget_maker_2_0/data/widget_elements/scripts/widgets/generators/bulid_registry.dart';
import 'package:yaml/yaml.dart';
import 'widgets/models.dart';
void main() async {
var file = File("../config.yaml");
String configContent = await file.readAsString();
YamlMap parsedYaml = loadYaml(configContent);
YamlMap widgets = parsedYaml["widgets"];
List<ParsedWidget> parsedWidgets = [];
for(String widget in widgets.keys) {
YamlMap props = widgets[widget];
ParsedWidget parsedWidget = parseWidget(widget, props);
parsedWidgets.add(parsedWidget);
writeWidget(parsedWidget);
}
writeImporter(parsedWidgets);
await writeRegistry(parsedWidgets);
print("Writing enums");
List<ParsedProp> enums = parseEnumProperties();
writeObjectProperties(enums.whereType<ObjectProp>().toList());
writeEnumProperties(enums.whereType<ParsedEnum>().toList());
print("Writing serializer");
writeWidgetsSerializer(parsedWidgets, enums.whereType<ObjectProp>().toList());
finalWidgetConverter(parsedWidgets);
}