我想知道这个间隙是如何产生的,尽管看起来很漂亮
展开似乎是自动设置了高度。这个高度有规律吗?如何删除
这是一种由cloumn和row组成的形式,文本字段位于行中,并由Expanded包裹
Column(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image(
image: AssetImage("img/phone_icon.png"),
width: 36.w,
height: 19.h,
fit: BoxFit.fill,
),
Text(
"+60",
style:
TextStyle(color: Color(0xff666666), fontSize: 15.sp),
),
Container(
margin: EdgeInsets.fromLTRB(15.w, 0, 14.w, 0),
alignment: Alignment.center,
width: 1.w,
height: 12.h,
decoration: BoxDecoration(color: Color(0xffCCCCCC)),
),
Expanded(
child: TextField(
controller: phoneController,
style: TextStyle(
color: Color(0xff666666),
fontSize: 15.sp,
),
decoration: InputDecoration(
hintText: S.of(context).phoneNumber,
hintStyle: TextStyle(
color: Color(0xFFCCCCCC),
),
border: InputBorder.none),
inputFormatters: [
WhitelistingTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(10)
],
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
cursorColor: Color(0xFF1FA2FF),
),
)
],
),
)
......
答案 0 :(得分:0)
您可以在输入修饰中使用contentPadding
来调整TextField输入的高度
....
TextField(
InputDecoration(
hintText: "Search users",
contentPadding: EdgeInsets.symmetric(
vertical: 15.0,
)
)
....