Flutterアイコン

Flutterで用意されているマテリアルアイコンを使う

公式 Iconsクラス

コード例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const <Widget>[
Icon(
Icons.favorite,
color: Colors.pink,
size: 24.0,
semanticLabel: 'Text to announce in accessibility modes',
),
Icon(
Icons.audiotrack,
color: Colors.green,
size: 30.0,
),
Icon(
Icons.beach_access,
color: Colors.blue,
size: 36.0,
),
],
)

Font Awesomeを使う

プラグイン font_awesome_flutter

使えるアイコン

1
2
3
4
5
6
7
8
9
10
11
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
return new IconButton(
// Use the FontAwesomeIcons class for the IconData
icon: new Icon(FontAwesomeIcons.gamepad),
onPressed: () { print("Pressed"); }
);
}
}

コメント

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×