add FlutterIcons

master
lmy 5 years ago
parent 146d0061fa
commit 44e603c81b

File diff suppressed because it is too large Load Diff

@ -17,3 +17,4 @@ export 'src/font_awesome_5_solid.dart';
export 'src/font_awesome_5_brands.dart'; export 'src/font_awesome_5_brands.dart';
export 'src/icon_toggle.dart'; export 'src/icon_toggle.dart';
export 'src/weather_icons.dart'; export 'src/weather_icons.dart';
export 'src/flutter_icons.dart';

File diff suppressed because it is too large Load Diff

@ -0,0 +1,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
}
Loading…
Cancel
Save