放在点击事件里面就行了,从下往上弹出提示
效果:
在这里插入图片描述
代码:

showModalBottomSheet(
    context: context,
    builder: (BuildContext context) {
        return Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
				// 增加ListTile就能增加弹出的选项
                ListTile(
                    title: Center(
                        child: Text(
                            "删除",
                            style: TextStyle(color: Colors.blue),
                        ),
                    ),
                    onTap: () async {
                        print('点击了删除');
                        print(index);
                        Navigator.pop(context);
                    },
                ),
                ListTile(
                    title: Center(
                        child: Text(
                            "取消",
                            style: TextStyle(color: Colors.blue),
                        ),
                    ),
                    onTap: () async {
                        print('点击取消');
                        Navigator.pop(context);
                    },
                ),
            ],
        );
    });
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐