上面的代码中标题和输入框需要增加下划线
时间: 2024-02-27 13:51:21 浏览: 20
好的,你可以按照以下方式修改示例代码来实现标题和输入框的下划线:
```
Container(
padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'标题',
style: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
SizedBox(height: 5.0),
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5.0),
),
child: TextFormField(
style: TextStyle(color: Colors.black87),
decoration: InputDecoration(
hintText: '请输入内容',
hintStyle: TextStyle(color: Colors.black54),
border: InputBorder.none,
contentPadding: EdgeInsets.symmetric(horizontal: 10.0),
),
),
),
],
),
)
```
在这个示例中,我们将`Row`替换为了`Column`,并在标题和输入框之间添加了一个`SizedBox`小部件来增加间距。我们还在输入框的外部添加了一个`Container`小部件,并在其中设置了背景色、圆角以及边框样式,以实现下划线的效果。注意,我们在`InputDecoration`中设置了`contentPadding`来使输入框内部的内容和下划线之间有一些水平间距。