如何在Flutter中向我的应用添加社交媒体链接/按钮?

li9yvcax  于 2023-01-31  发布在  Flutter
关注(0)|答案(2)|浏览(139)

我想将图片中电子邮件卡片下方的按钮更改为社交媒体链接。但是,我在查找这些链接的图标时遇到问题。我希望能够操作图标并更改颜色。
Here's My App
我想出的一个解决方案是使用内部的图像资源而不是图标,但这样做我无法更改颜色。
下面是我的代码:

Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Padding(
                padding: const EdgeInsets.all(10.0),
                child: Container(
                  color: Colors.white,
                  child: IconButton(
                    onPressed: null,
                    icon: Icon(
                      Icons.ac_unit,
                      color: Colors.black,
                    ),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(10.0),
                child: Container(
                  color: Colors.white,
                  child: IconButton(
                    onPressed: null,
                    icon: Icon(
                      Icons.ac_unit,
                      color: Colors.black,
                    ),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(10.0),
                child: Container(
                  color: Colors.white,
                  child: IconButton(
                    onPressed: null,
                    icon: Icon(
                      Icons.ac_unit,
                      color: Colors.black,
                    ),
                  ),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(10.0),
                child: Container(
                  color: Colors.white,
                  child: IconButton(
                    onPressed: null,
                    icon: Icon(
                      Icons.ac_unit,
                      color: Colors.black,
                    ),
                  ),
                ),
              ),
            ],
          ),
56lgkhnf

56lgkhnf1#

您可以使用此软件包:https://pub.dev/packages/font_awesome_flutter
有了这个,你可以轻松地为图标设置样式:
Icon(FontAwesomeIcons.facebook, color: widget.color, size: 16.0)
图标名称可在此处找到:https://fontawesome.com/v5.15/icons?d=gallery&p=2

svmlkihl

svmlkihl2#

使用字体包_awesome_flutter
https://pub.dev/packages/font_awesome_flutter

Icon(
          FontAwesomeIcons.instagram,
          size: 100,
        ),

    Icon(
          FontAwesomeIcons.facebook,
          size: 100,
        ),

    Icon(
          FontAwesomeIcons.whatsapp,
          size: 100,
        ),

相关问题