我试图将搜索图标放置在行中第一个输入的周边内,但出现错误和空白屏幕。
没有 Stack 和 Positioned 的代码有效:
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',
),
),
],
),
布局异常之一说: 布局异常