【问题标题】:How can I generate this when I press the floating action button in flutter当我在颤动中按下浮动操作按钮时如何生成这个
【发布时间】:2022-11-04 20:10:25
【问题描述】:

当我按下浮动操作按钮时,我想生成一个容器或一个襟翼(我不知道这个词),一切都在屏幕上解释,非常感谢!

当我按下按钮时,我希望这个选项卡从底部到顶部生成,然后在我再次按下按钮时从顶部到底部消失

【问题讨论】:

  • 使用bottom sheet
  • 如果可能的话,用动画
  • 是的,bootm 工作表具有从底部开始的默认动画开口。

标签: flutter dart flutter-layout


【解决方案1】:

尝试这个:

InkWell(
    onTap: () async {
      showModalBottomSheet(
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(16.0),
          ),
          backgroundColor: Colors.white,
          builder: (BuildContext context) {
            return Column(
              children: [
                ElevatedButton(
                    onPressed: () {
                      Navigator.pop(context);
                    },
                    child: Text('Botton 1')),
                SizedBox(
                  height: 20,
                ),
                ElevatedButton(
                    onPressed: () {}, child: Text('Botton 2'))
              ],
            );
          },
          context: context);
    },
    child: Text('show'),
  ),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-13
    • 2020-01-03
    • 2021-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    相关资源
    最近更新 更多