flutter - 没有标题的颤振对话框
问题描述
我的代码
return Dialog(
insetPadding: EdgeInsets.all(50),
elevation: 0,
backgroundColor: Colors.transparent,
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Scaffold(
appBar: AppBar(
title: Text("Select a service"),
automaticallyImplyLeading: false,
actions: [
IconButton(
icon: Icon(MdiIcons.close),
onPressed: () => Navigator.pop(context)
)]
),
body: Text("This is just a test")
)
));
如何删除顶部不需要的标题区域?
解决方案
不要在 Dialog 中使用 Scaffod 小部件!你实际上并不需要那个。使用这样的列和行使其变得简单:
return Dialog(
insetPadding: EdgeInsets.all(50),
elevation: 0,
backgroundColor: Colors.transparent,
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Container(
child: Column(childre: [
Row(children:[Text("Select a service"), IconButton(
icon: Icon(MdiIcons.close),
onPressed: () => Navigator.pop(context)
)],
), // use this row for top bar and your action button, and use space between and wrap this row with a container for colors and etc
Container(child: Text("This is just a test")) // use this Container for rest
])
));
推荐阅读
- php - Wordpress 永久链接重写自定义分类法和帖子类型,在 URL 中使用父项和子项层次结构
- android - 如何从 Android Auto Backup 中排除 base.apk?
- windows - 使用 Cmake 构建 Geos
- javascript - 测试登录组件失败并出现错误:预期为真为假
- sql - 使用递增的时间戳执行插入
- c# - 正则表达式根据其中的值获取特定匹配括号后的所有内容
- php - 如何从 PHP 文件中查找和导入默认 CSS 标签
- chatbot - 一种响应的 AIML 多种模式
- python - 如何在python中找到numpy数组的枚举索引?
- angular - 通过 ionic 和 Angular 从现有 SQLite 数据库中读取数据