在图标下面的颤振字体令人敬畏的文本

问题描述 投票:1回答:1

我在我的flutter应用程序中使用字体真棒图标,我试图在图标下面放置描述性文本。我希望IconButton类中有一个属性,但是没有看到它。这是我的代码:

Container(
                margin: EdgeInsets.all(25.0),
                  child: IconButton(
                     icon: new Icon(FontAwesomeIcons.checkSquare,),
                     iconSize: 60.0,
                     color: const Color(0xFF0099a9),
                      onPressed: () { print("Pressed"); }
                  )

              ),
dart flutter
1个回答
1
投票

我几天前遇到过这个问题,这就是我解决它的方法:

Container(
  margin: EdgeInsets.all(25.0),
  child: Column(
    children: <Widget>[
      GestureDetector(
          child: Icon(
            FontAwesomeIcons.checkSquare,
            size: 60.0,
            color: const Color(0xFF0099a9),
          ),
          onTap: () {
            print("Pressed");
          }),
      Text("Some Text")
    ],
  ),
),

使用此解决方案,您可以访问更多功能。

可能有一个更清洁的解决方案,但这个非常适合制作带有下方文字的可点击图标;)

祝你今天愉快 !

© www.soinside.com 2019 - 2024. All rights reserved.