flutter - My second container is taking all the space.How to avoid that
问题描述
The second Container which is in the red color is taking all the remaining space. How to avoid that. I want my second container to take the minimum space.
Container(
height: 600,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(60),
),
),
child: Padding(
padding: const EdgeInsets.only(top: 80.0, right: 50, left: 50),
child: Container(
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.all(
Radius.circular(20),
),
),
child: Column(
children: [
TextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: "Email or Phone Number"),
),
SizedBox(
height: 20,
),
TextField(
decoration:
new InputDecoration.collapsed(hintText: 'PassWord'),
)
],
),
),
),
),[![][1]][1]
解决方案
Try below code hope its helpful to you. Just remove your container extra/large height
Container(
height: 180,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(
60,
),
),
),
child: Padding(
padding: const EdgeInsets.only(top: 80.0, right: 50, left: 50),
child: Container(
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.all(
Radius.circular(20),
),
),
child: Column(
children: [
TextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
labelText: "Email or Phone Number",
),
),
SizedBox(
height: 20,
),
TextField(
decoration: InputDecoration.collapsed(
hintText: 'PassWord',
),
)
],
),
),
),
),
推荐阅读
- ios - Xcode 13.1 + MacOS Monterey (12.0.1) + M1 芯片 (8gb) + 构建时间 + 系统挂起
- react-native - 为什么我总是要在 expo 版本之间切换
- javascript - 在新选项卡上保留状态,但不刷新页面
- java - Java 线程安全问题
- python - NumPy 通过 astype 转换二维数组中的混合数据类型
- django - django + restframework如何通过继承类实现参数接口
- java - 我的 android studio 代码构建成功但输出应用程序崩溃
- c++ - 最后一个 0 是文字吗?
- mysql - 如何使用laravel在数据库中上传多个文件
- php - 它是如何工作的静态方法和变量