【发布时间】:2021-08-03 08:03:21
【问题描述】:
我正在尝试将搜索图标定位在行中第一个输入的周边内,但出现错误和空白屏幕。
没有堆栈和定位的代码有效:
Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: InputText(
label: 'Article infrigit',
readOnly: true,
placeholder: '29.1',
),
),
),
Image.asset('assets/images/searchIcon.png',
width: 32.0),
Expanded(
child: InputText(
label: 'Import Sanció €',
readOnly: true,
placeholder: '100,00',
),
),
],
),
Stack 和 Positioned 的代码没有:
Row(
children: [
Stack(children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: InputText(
label: 'Article infrigit',
readOnly: true,
placeholder: '29.1',
),
),
),
Positioned(
top: 0,
right: 0,
child: Image.asset('assets/images/searchIcon.png',
width: 32.0),
),
]),
Expanded(
child: InputText(
label: 'Import Sanció €',
readOnly: true,
placeholder: '100,00',
),
),
],
),
其中一个布局例外说: layout exception
【问题讨论】:
标签: flutter stack flutter-positioned