2
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

FlutterアプリへFontAwesomeを追加する方法

1,やり方

1-1,
pubspec.yamlのdependenciesに
font_awesome_flutter: ^8.11.0
を追加

pubspec.yaml
dependencies:
  flutter:
    sdk: flutter
 ## 省略 ##
  font_awesome_flutter: ^8.11.0

1-2,
flutter pub getする。

2,使い方

Twitterやインスタグラムのアイコンなど、Iconsからは取れないようなものに対して使います。
下記はボトムナビゲーションバーのサンプルです。
(font_awesomeの用例がメインのため、切り替えなどのギミックは除いてあります)

hoge.dart
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
return Scaffold(
        appBar: //
        body: //
        backgroundColor: //
        bottomNavigationBar: BottomNavigationBar(
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.home,color: Colors.grey),
              title: Text("Home"),
            ),
            BottomNavigationBarItem(
              icon: FaIcon(FontAwesomeIcons.twitter,color: Colors.grey),
              title: Text("Twitter"),
            ),
            BottomNavigationBarItem(
              icon: FaIcon(FontAwesomeIcons.instagram,color: Colors.grey,),
              title: Text("Instagram"),
            ),
          ],
       ),
      );

3,使えるアイコン一覧
使えるアイコン一覧はこちらです。
https://fontawesome.com/icons?d=gallery

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
2
Help us understand the problem. What are the problem?