【发布时间】:2020-08-28 16:36:30
【问题描述】:
作为一个颤振造型的新手,我正在尝试创建一个看起来像这样的行
我无法将 textField 放在左侧,宽度不固定,汽车图标放在最右侧。
我试图用Stack 破解它,但文本在到达图标时会覆盖它。有人可以提供一种更好的方法将这两个小部件并排放置。
我的尝试
Positioned(
top: 50.0,
right: 15.0,
left: 15.0,
child: Container(
height: 50.0,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3.0),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey,
offset: Offset(1.0, 5.0),
blurRadius: 10,
spreadRadius: 3)
],
),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Stack(
children: [
TextField(
cursorColor: Colors.black,
// controller: appState.locationController,
decoration: InputDecoration(
hintText: "pick up",
border: InputBorder.none,
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// contentPadding: EdgeInsets.only(left: 15.0, top: 16.0),
icon: Container(
margin: EdgeInsets.only(left: 10),
width: 10,
height: 10,
child: Icon(
Icons.location_on,
color: Colors.black,
),
),
),
),
Positioned(
right: 8,
child: IconButton(icon: Icon(Icons.business), onPressed: () {})
)
],
),
),
]
),
]
),
),
),
【问题讨论】:
标签: flutter flutter-layout flutter-animation