I want to make a screen that displays all available flutter icons
can anyone suggest me for loop coding for showing all flutter default icon list in ListView Icon and Icon name
CodePudding user response:
There is no flutter API to get all flutter Icons. Developers can access all those default icon one by one. you can make a list of icon by youself. for example:
static const _iconList = <IconData>[
Icons.cake,
Icons.add_location_sharp,
Icons.zoom_in_outlined,
Icons.auto_awesome_motion,
Icons.call_end_sharp,
Icons.equalizer_rounded,
Icons.wifi_lock,
Icons.mail,
etc................,
];
Use the list in listView as like
...
Container(
child: ListView(
children: _iconList .map((icon) => Icon(icon)).toList(),
),
)
...
You can go through all flutter icons from bleow links.
Default Material Icons: https://api.flutter.dev/flutter/material/Icons-class.html
Flutter custom icons generator: https://www.fluttericon.com/
FontAwesomeIcons: https://pub.dev/packages/font_awesome_flutter
other link : https://www.fluttericon.com/
CodePudding user response:
use this link https://github.com/Ahmadre/FlutterIconPicker/blob/master/lib/IconPicker/Packs/Material.dart and get all the available flutter icons, and list using listview.
The above link contains all the icon variables with the respective names.
Map<String, IconData> icons_data = {
'ac_unit': Icons.ac_unit,
'ac_unit_sharp': Icons.ac_unit_sharp,
'ac_unit_rounded': Icons.ac_unit_rounded,
'ac_unit_outlined': Icons.ac_unit_outlined,
ect...
}
ListView.builder(
shrinkWrap: true,
itemCount: icons_data.length,
itemBuilder: (context, index) {
var item = icons_data.entries.elementAt(index);
return Row(
childern:[
Text(item.key " - "),
Icon(item.value)
]
);
},
)