diff --git a/example/lib/main.dart b/example/lib/main.dart index a7574d4..df0548b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; +import 'ant_design_page.dart'; void main() => runApp(MyApp()); @@ -21,7 +22,10 @@ class MyApp extends StatelessWidget { // is not restarted. primarySwatch: Colors.blue, ), - home: MyHomePage(title: 'Flutter Demo Home Page'), + home: MyHomePage(title: 'Icons Explorer'), + routes: { + "icon_page":(_)=>AntDesignPage() + }, ); } } @@ -29,15 +33,6 @@ class MyApp extends StatelessWidget { class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); - // This widget is the home page of your application. It is stateful, meaning - // that it has a State object (defined below) that contains fields that affect - // how it looks. - - // This class is the configuration for the state. It holds the values (in this - // case the title) provided by the parent (in this case the App widget) and - // used by the build method of the State. Fields in a Widget subclass are - // always marked "final". - final String title; @override @@ -45,7 +40,53 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - bool _value = false; + buildChildren() { + Map map = { + "AntDesign": AntDesign.glyphMaps, + "Entypo": Entypo.glyphMaps, + "EvilIcons": EvilIcons.glyphMaps, + "Feather": Feather.glyphMaps, + "FontAwesome":FontAwesome.glyphMaps, + "Foundation": Foundation.glyphMaps, + "Ionicons": Ionicons.glyphMaps, + "MaterialCommunityIcons": MaterialCommunityIcons.glyphMaps, + "MaterialIcons": MaterialIcons.glyphMaps, + "Octicons": Octicons.glyphMaps, + "SimpleLineIcons": SimpleLineIcons.glyphMaps, + "Zocial":Zocial.glyphMaps + }; + List widgets = []; + for (int i = 0; i < map.keys.length; i++) { + widgets.add(GestureDetector( + onTap: (){ + Navigator.of(context).pushNamed("icon_page",arguments: { + "glyphMaps":map[map.keys.elementAt(i)], + "iconSetName":map.keys.elementAt(i) + }); + }, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(map.keys.elementAt(i)), + Spacer(), + Text(map[map.keys.elementAt(i)].length.toString()), + Icon(Icons.arrow_forward_ios) + ], + ), + ), + )); + if (i != map.keys.length - 1) { + widgets.add(Container( + height: 1, + color: Colors.black.withOpacity(0.3), + )); + } + } + return widgets; + } + @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -60,43 +101,11 @@ class _MyHomePageState extends State { // the App.build method, and use it to set our appbar title. title: Text(widget.title), ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. + body: Padding( + padding: const EdgeInsets.all(20.0), child: Column( - // Column is also layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(FontAwesome5.getIconData("address-book")), - Icon(FontAwesome5.getIconData("address-book", - weight: IconWeight.Solid)), - Icon(FontAwesome5.getIconData("500px", weight: IconWeight.Brand)), - Icon(Ionicons.getIconData("ios-search")), - Icon(AntDesign.getIconData("stepforward")), - Icon(FontAwesome.getIconData("glass")), - Icon(MaterialIcons.getIconData("ac-unit")), - IconToggle( - value: _value, - onChanged: (value) { - setState(() { - _value = value; - }); - }, - ), - ], + crossAxisAlignment: CrossAxisAlignment.start, + children: buildChildren(), ), ), ); diff --git a/lib/ant_design.dart b/lib/ant_design.dart index cf42aaf..e34228a 100644 --- a/lib/ant_design.dart +++ b/lib/ant_design.dart @@ -5,10 +5,13 @@ class AntDesign { } static hasIconData(iconName)=>_antDesign.containsKey(iconName); + + static const glyphMaps = _antDesign; } -final Map _antDesign ={ + +const Map _antDesign ={ "stepforward": 58880, "stepbackward": 58881, "forward": 58882, diff --git a/lib/entypo.dart b/lib/entypo.dart index 4070262..9bf5e3d 100644 --- a/lib/entypo.dart +++ b/lib/entypo.dart @@ -6,7 +6,10 @@ class Entypo { } static hasIconData(iconName)=>_entypo.containsKey(iconName); + + static const glyphMaps = _entypo; } + const Map _entypo ={ "500px": 61696, "500px-with-circle": 61697, diff --git a/lib/evil_icons.dart b/lib/evil_icons.dart index 4a13b89..dbc38ad 100644 --- a/lib/evil_icons.dart +++ b/lib/evil_icons.dart @@ -6,6 +6,8 @@ class EvilIcons { } static hasIconData(iconName)=>_evilIcons.containsKey(iconName); + + static const glyphMaps = _evilIcons; } const Map _evilIcons = { "archive": 61696, diff --git a/lib/feather.dart b/lib/feather.dart index 65ce40d..5a46ca1 100644 --- a/lib/feather.dart +++ b/lib/feather.dart @@ -6,6 +6,8 @@ class Feather { } static hasIconData(iconName)=>_feather.containsKey(iconName); + + static const glyphMaps = _feather; } const Map _feather ={ "activity": 59648, diff --git a/lib/font_awesome.dart b/lib/font_awesome.dart index 7674a8c..6e2af71 100644 --- a/lib/font_awesome.dart +++ b/lib/font_awesome.dart @@ -6,6 +6,8 @@ class FontAwesome { } static hasIconData(iconName)=>_fontAwesome.containsKey(iconName); + + static const glyphMaps = _fontAwesome; } const Map _fontAwesome = { "glass": 61440, diff --git a/lib/foundation.dart b/lib/foundation.dart index 4e26e11..159e80b 100644 --- a/lib/foundation.dart +++ b/lib/foundation.dart @@ -6,6 +6,8 @@ class Foundation { } static hasIconData(iconName)=>_foundation.containsKey(iconName); + + static const glyphMaps = _foundation; } const Map _foundation = { "address-book": 61696, diff --git a/lib/ionicons.dart b/lib/ionicons.dart index 1c8236b..39bec4c 100644 --- a/lib/ionicons.dart +++ b/lib/ionicons.dart @@ -7,8 +7,11 @@ class Ionicons{ } static hasIconData(iconName)=>_ionicons.containsKey(iconName); + + static const glyphMaps = _ionicons; } + const Map _ionicons = const { "ios-add": 61698, "ios-add-circle": 61697, diff --git a/lib/material_community_icons.dart b/lib/material_community_icons.dart index 668f9ce..dff253f 100644 --- a/lib/material_community_icons.dart +++ b/lib/material_community_icons.dart @@ -6,8 +6,9 @@ class MaterialCommunityIcons { } static hasIconData(iconName)=>_materialCommunityIcons.containsKey(iconName); -} + static const glyphMaps = _materialCommunityIcons; +} const Map _materialCommunityIcons = { "ab-testing": 983068, "access-point": 61442, diff --git a/lib/material_icons.dart b/lib/material_icons.dart index ee4e144..6608169 100644 --- a/lib/material_icons.dart +++ b/lib/material_icons.dart @@ -5,6 +5,8 @@ class MaterialIcons { } static hasIconData(iconName)=>_materialIcons.containsKey(iconName); + static const glyphMaps = _materialIcons; + } const Map _materialIcons = { "3d-rotation": 59469, diff --git a/lib/octicons.dart b/lib/octicons.dart index 4de118e..3189e8d 100644 --- a/lib/octicons.dart +++ b/lib/octicons.dart @@ -6,6 +6,8 @@ class Octicons { } static hasIconData(iconName)=>_octicons.containsKey(iconName); + + static const glyphMaps = _octicons; } const Map _octicons ={ "alert": 61696, diff --git a/lib/simple_line_icons.dart b/lib/simple_line_icons.dart index ffc1995..4a33d71 100644 --- a/lib/simple_line_icons.dart +++ b/lib/simple_line_icons.dart @@ -6,6 +6,8 @@ class SimpleLineIcons { } static hasIconData(iconName)=>_simpleLineIcons.containsKey(iconName); + + static const glyphMaps = _simpleLineIcons; } const Map _simpleLineIcons = { "user": 57349, diff --git a/lib/zocial.dart b/lib/zocial.dart index 7fadc82..8b23fc1 100644 --- a/lib/zocial.dart +++ b/lib/zocial.dart @@ -5,6 +5,8 @@ class Zocial { } static hasIconData(iconName)=>_zocial.containsKey(iconName); + + static const glyphMaps = _zocial; } const Map _zocial = { "acrobat": 61696,