forked from flutter-studio/flutter-icons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
99 lines (83 loc) · 1.97 KB
/
main.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import 'dart:io';
main(List<String> args) {
Directory directory = Directory("../lib/src");
File flutterIconFile = File('../lib/src/flutter_icons.dart');
List<File> files = directory.listSync().map((e)=>File(e.path)).toList();
String str = '''
import 'package:flutter/material.dart';
import 'flutter_icon_data.dart';
class FlutterIcons {
FlutterIcons._();
''';
for(var i=0;i<files.length;i++){
final File file = files[i];
if(file.path.indexOf("flutter_icon") == -1 && file.path.indexOf("icon_toggle") == -1){
final List<String> lines = file.readAsLinesSync();
for(var k=0;k<lines.length;k++){
final String line = lines[k];
if(line.contains('static const')){
print(file.path);
var suffix = getSimple(line);
List lineList = line.split(" ");
lineList[5] = lineList[5]+'_$suffix';
String temp = lineList.join(" ");
str += '\n';
str += temp;
}
}
}
}
str += '}';
flutterIconFile.writeAsStringSync(str);
// directory.list().forEach((file)=>print(file.path));
}
String getSimple(String line){
print(line);
var name1 = line.split(".")[1];
var name = name1.split("(")[0];
if(name == 'materialCommunityIcons')
return 'mco';
if(name == 'materialIcons')
return 'mdi';
if(name == 'simpleLineIcons')
return 'sli';
if(name == 'fontAwesome')
return 'faw';
if(name == 'fontAwesome5')
return 'faw5';
if(name == 'fontAwesome5Solid')
return 'faw5s';
if(name == 'fontAwesome5Brands')
return 'faw5d';
return name.substring(0,3).toLowerCase();
}
enum IconLib {
///All Icons
all,
///Ant Design Icons
ant,
///Entypo Icons
ent,
///Evil Icons
evi,
///Feather Icons
fea,
///Font Awesome Icons
faw,
///Foundation Icons
fou,
///Ionicons Icons
ion,
///Material Community Icons
mco,
///Material Icons
mdi,
///Octicons Icons
oct,
///Simple Line Icons
sli,
///Zocial Icons
zoc,
///Weather Icons
wea
}