add glyphMaps attribute

master
lmy 5 years ago
parent 02cb130ed5
commit 65512e75bf

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'ant_design_page.dart';
void main() => runApp(MyApp()); void main() => runApp(MyApp());
@ -21,7 +22,10 @@ class MyApp extends StatelessWidget {
// is not restarted. // is not restarted.
primarySwatch: Colors.blue, 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 { class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key); 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; final String title;
@override @override
@ -45,7 +40,53 @@ class MyHomePage extends StatefulWidget {
} }
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
bool _value = false; buildChildren() {
Map<String, dynamic> 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<Widget> 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: <Widget>[
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done // This method is rerun every time setState is called, for instance as done
@ -60,43 +101,11 @@ class _MyHomePageState extends State<MyHomePage> {
// the App.build method, and use it to set our appbar title. // the App.build method, and use it to set our appbar title.
title: Text(widget.title), title: Text(widget.title),
), ),
body: Center( body: Padding(
// Center is a layout widget. It takes a single child and positions it padding: const EdgeInsets.all(20.0),
// in the middle of the parent.
child: Column( child: Column(
// Column is also layout widget. It takes a list of children and crossAxisAlignment: CrossAxisAlignment.start,
// arranges them vertically. By default, it sizes itself to fit its children: buildChildren(),
// 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: <Widget>[
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;
});
},
),
],
), ),
), ),
); );

@ -5,10 +5,13 @@ class AntDesign {
} }
static hasIconData(iconName)=>_antDesign.containsKey(iconName); static hasIconData(iconName)=>_antDesign.containsKey(iconName);
static const glyphMaps = _antDesign;
} }
final Map<String,int> _antDesign ={
const Map<String,int> _antDesign ={
"stepforward": 58880, "stepforward": 58880,
"stepbackward": 58881, "stepbackward": 58881,
"forward": 58882, "forward": 58882,

@ -6,7 +6,10 @@ class Entypo {
} }
static hasIconData(iconName)=>_entypo.containsKey(iconName); static hasIconData(iconName)=>_entypo.containsKey(iconName);
static const glyphMaps = _entypo;
} }
const Map<String,int> _entypo ={ const Map<String,int> _entypo ={
"500px": 61696, "500px": 61696,
"500px-with-circle": 61697, "500px-with-circle": 61697,

@ -6,6 +6,8 @@ class EvilIcons {
} }
static hasIconData(iconName)=>_evilIcons.containsKey(iconName); static hasIconData(iconName)=>_evilIcons.containsKey(iconName);
static const glyphMaps = _evilIcons;
} }
const Map<String, int> _evilIcons = { const Map<String, int> _evilIcons = {
"archive": 61696, "archive": 61696,

@ -6,6 +6,8 @@ class Feather {
} }
static hasIconData(iconName)=>_feather.containsKey(iconName); static hasIconData(iconName)=>_feather.containsKey(iconName);
static const glyphMaps = _feather;
} }
const Map<String,int> _feather ={ const Map<String,int> _feather ={
"activity": 59648, "activity": 59648,

@ -6,6 +6,8 @@ class FontAwesome {
} }
static hasIconData(iconName)=>_fontAwesome.containsKey(iconName); static hasIconData(iconName)=>_fontAwesome.containsKey(iconName);
static const glyphMaps = _fontAwesome;
} }
const Map<String ,int> _fontAwesome = { const Map<String ,int> _fontAwesome = {
"glass": 61440, "glass": 61440,

@ -6,6 +6,8 @@ class Foundation {
} }
static hasIconData(iconName)=>_foundation.containsKey(iconName); static hasIconData(iconName)=>_foundation.containsKey(iconName);
static const glyphMaps = _foundation;
} }
const Map<String,int> _foundation = { const Map<String,int> _foundation = {
"address-book": 61696, "address-book": 61696,

@ -7,8 +7,11 @@ class Ionicons{
} }
static hasIconData(iconName)=>_ionicons.containsKey(iconName); static hasIconData(iconName)=>_ionicons.containsKey(iconName);
static const glyphMaps = _ionicons;
} }
const Map<String, int> _ionicons = const { const Map<String, int> _ionicons = const {
"ios-add": 61698, "ios-add": 61698,
"ios-add-circle": 61697, "ios-add-circle": 61697,

@ -6,8 +6,9 @@ class MaterialCommunityIcons {
} }
static hasIconData(iconName)=>_materialCommunityIcons.containsKey(iconName); static hasIconData(iconName)=>_materialCommunityIcons.containsKey(iconName);
}
static const glyphMaps = _materialCommunityIcons;
}
const Map<String,int> _materialCommunityIcons = { const Map<String,int> _materialCommunityIcons = {
"ab-testing": 983068, "ab-testing": 983068,
"access-point": 61442, "access-point": 61442,

@ -5,6 +5,8 @@ class MaterialIcons {
} }
static hasIconData(iconName)=>_materialIcons.containsKey(iconName); static hasIconData(iconName)=>_materialIcons.containsKey(iconName);
static const glyphMaps = _materialIcons;
} }
const Map<String,int> _materialIcons = { const Map<String,int> _materialIcons = {
"3d-rotation": 59469, "3d-rotation": 59469,

@ -6,6 +6,8 @@ class Octicons {
} }
static hasIconData(iconName)=>_octicons.containsKey(iconName); static hasIconData(iconName)=>_octicons.containsKey(iconName);
static const glyphMaps = _octicons;
} }
const Map<String,int> _octicons ={ const Map<String,int> _octicons ={
"alert": 61696, "alert": 61696,

@ -6,6 +6,8 @@ class SimpleLineIcons {
} }
static hasIconData(iconName)=>_simpleLineIcons.containsKey(iconName); static hasIconData(iconName)=>_simpleLineIcons.containsKey(iconName);
static const glyphMaps = _simpleLineIcons;
} }
const Map<String,int> _simpleLineIcons = { const Map<String,int> _simpleLineIcons = {
"user": 57349, "user": 57349,

@ -5,6 +5,8 @@ class Zocial {
} }
static hasIconData(iconName)=>_zocial.containsKey(iconName); static hasIconData(iconName)=>_zocial.containsKey(iconName);
static const glyphMaps = _zocial;
} }
const Map<String,int> _zocial = { const Map<String,int> _zocial = {
"acrobat": 61696, "acrobat": 61696,

Loading…
Cancel
Save