【问题标题】:Flutter two action buttonFlutter 两个动作按钮
【发布时间】:2022-11-28 09:32:39
【问题描述】:

如何在同一屏幕中添加 2 个操作按钮?我试过使用行和列,但它没有像我想要的那样工作。我想在最后添加一个动作按钮。 Here

 child: Container(
            color: randomColor,
            child: Center(
              child: Text(
                randomName!,
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontSize: 30.sp,
                    color: Colors.white70,
                    fontStyle: FontStyle.italic,
                    fontWeight: FontWeight.bold),
              ),
            )),
      ),
      floatingActionButton: IconButton(
        icon: const Icon(
          Icons.format_quote_outlined,
          color: Colors.white70,
          size: 80,
        ),
        onPressed: () {},
      ),
      floatingActionButtonLocation:
          FloatingActionButtonLocation.miniStartTop,

【问题讨论】:

  • 你可以使用堆栈

标签: flutter


【解决方案1】:

建议每个屏幕只使用一个浮动操作按钮,但你可以看到这个解决方案:https://tealfeed.com/guide-two-floating-action-buttons-flutter-jcjpf

【讨论】:

    【解决方案2】:

    您可以使用 Stack 小部件进行更多叠加。

    body: Stack(
      children: [
    ......
        Positioned(
          bottom: 24,
          left: 24,
          child: FloatingActionButton(onPressed: (){},))
      ],
    ),
    

    【讨论】:

      猜你喜欢
      • 2020-09-23
      • 2019-08-05
      • 2021-01-03
      • 2012-05-19
      • 2020-07-03
      • 1970-01-01
      • 2017-08-11
      • 2014-04-11
      • 2020-03-25
      相关资源
      最近更新 更多