material_design_symbols 1.0.2
material_design_symbols: ^1.0.2 copied to clipboard
Google's Material Symbols icon library for Flutter
import 'package:flutter/material.dart';
import 'package:material_design_symbols/material_design_symbols.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
home: const MyHomePage(title: 'Material Design Symbols Example'),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(title)),
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'Material Symbols for Flutter',
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 48.0),
// Direct widget constructor using SymbolOutlined
const SymbolOutlined.zonePersonAlert(size: 48.0, color: Colors.red),
const Text(
'SymbolOutlined.zonePersonAlert(size: 48.0, color: Colors.red)',
),
const SizedBox(height: 24.0),
// Standard approach: passing IconData into an Icon widget
const Icon(
SymbolsOutlined.zonePersonAlert,
size: 48.0,
color: Colors.blue,
),
const Text(
'Icon(SymbolsOutlined.zonePersonAlert, size: 48.0, color: Colors.blue)',
),
const SizedBox(height: 24.0),
// Dynamic map lookup approach
Icon(
SymbolsOutlined.iconMap['zone_person_alert'],
size: 48.0,
color: Colors.amber,
),
const Text(
"Icon(SymbolsOutlined.iconMap['zone_person_alert'], size: 48.0, color: Colors.amber)",
),
],
),
),
);
}
}