hugeicons_plus 0.1.1
hugeicons_plus: ^0.1.1 copied to clipboard
5,400+ Hugeicons as a variable-stroke Flutter icon font. Native IconData; stroke width is Icon.weight, generated with fontify_plus.
import 'package:flutter/material.dart';
import 'catalog.dart';
void main() => runApp(const GalleryApp());
class GalleryApp extends StatelessWidget {
const GalleryApp({super.key, this.icons = catalog});
final List<(String, IconData)> icons;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'HugeIcons',
theme: ThemeData(colorSchemeSeed: Colors.teal, useMaterial3: true),
home: GalleryPage(icons: icons),
);
}
}
class GalleryPage extends StatefulWidget {
const GalleryPage({super.key, required this.icons});
final List<(String, IconData)> icons;
@override
State<GalleryPage> createState() => _GalleryPageState();
}
class _GalleryPageState extends State<GalleryPage> {
String _query = '';
double _size = 24;
double _weight = 1.5;
List<(String, IconData)> get _visible {
final q = _query.trim().toLowerCase();
if (q.isEmpty) return widget.icons;
return widget.icons.where((e) => e.$1.toLowerCase().contains(q)).toList();
}
@override
Widget build(BuildContext context) {
final visible = _visible;
return Scaffold(
appBar: AppBar(title: Text('HugeIcons (${visible.length})')),
body: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: TextField(
decoration: const InputDecoration(
prefixIcon: Icon(Icons.search),
hintText: 'Search',
border: OutlineInputBorder(),
isDense: true,
),
onChanged: (v) => setState(() => _query = v),
),
),
_SliderRow(
label: 'Size',
value: _size,
min: 12,
max: 64,
display: _size.round().toString(),
onChanged: (v) => setState(() => _size = v),
),
_SliderRow(
label: 'Weight',
value: _weight,
min: 0.5,
max: 3,
display: _weight.toStringAsFixed(2),
onChanged: (v) => setState(() => _weight = v),
),
Expanded(
child: GridView.builder(
padding: const EdgeInsets.all(8),
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 104,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
childAspectRatio: 0.8,
),
itemCount: visible.length,
itemBuilder: (context, i) {
final (name, icon) = visible[i];
return Tooltip(
message: name,
child: Column(
children: [
Expanded(
child: Center(
child: Icon(icon, size: _size, weight: _weight),
),
),
Text(
name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 11),
),
],
),
);
},
),
),
],
),
);
}
}
class _SliderRow extends StatelessWidget {
const _SliderRow({
required this.label,
required this.value,
required this.min,
required this.max,
required this.display,
required this.onChanged,
});
final String label;
final double value;
final double min;
final double max;
final String display;
final ValueChanged<double> onChanged;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
children: [
SizedBox(width: 64, child: Text(label)),
Expanded(
child: Slider(
value: value,
min: min,
max: max,
onChanged: onChanged,
),
),
SizedBox(
width: 40,
child: Text(display, textAlign: TextAlign.end),
),
],
),
);
}
}