带有图标和背景颜色的圆形按钮

时间:2019-05-18 12:03:17

标签: android flutter

我想在容器中获得这种类型的按钮,

How can I get this

代替这些图标按钮

Instead of this in flutter

2 个答案:

答案 0 :(得分:0)

将BottomAppBar与FloatingActionButton一起使用

此处的示例:https://medium.com/coding-with-flutter/flutter-bottomappbar-navigation-with-fab-8b962bb55013

答案 1 :(得分:0)

看看FloatingActionButton(FAB)。例如:

FloatingActionButton(
  onPressed: () {
    handlePressed()
  },
  child: SomeIcon(),
  backgroundColor: Colors.red,
);

或者,您可以执行以下操作:

GestureDetector(
  child: Container(
    child: DecoratedBox(
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        color: Colors.red,
      ),
      child: SomeIcon(),
    ),
  ),
  onTap: () => handleTap(),
);

尽管在您的情况下,我还是认为FAB更有意义,从屏幕快照中可以看出,它位于BottomAppBar上。