当我尝试创建带有包含TextFormField标题的ListTile时,我无法添加字幕,否则字幕会爆炸。
这是一个简单的例子:
ListTile(
title: TextFormField(
initialValue: 'foo',
),
subtitle: const Text('bar'),
),
当我将此代码段添加到代码中并运行它时,我得到:
I/flutter (20366): RenderParagraph#3f385 relayoutBoundary=up8 NEEDS-PAINT
I/flutter (20366): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (20366): Another exception was thrown: RenderBox was not laid out: _RenderListTile#76527 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (20366): Another exception was thrown: RenderBox was not laid out: RenderPadding#61d3e relayoutBoundary=up6 NEEDS-PAINT
I/flutter (20366): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#eaf9a relayoutBoundary=up5 NEEDS-PAINT
I/flutter (20366): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#479d1 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (20366): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#1419c relayoutBoundary=up3 NEEDS-PAINT
I/flutter (20366): Another exception was thrown: 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 310 pos 12: 'child.hasSize': is not true.
I/flutter (20366): Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
D/ (20366): HostConnection::get() New Host Connection established 0xd0a0ab40, tid 20389
W/ (20366): Unrecognized GLES max version string in extensions:
这是错误还是只是无效的请求?
我的最终目标是创建一个显示标签和单位的TextFormField。例如,一个字段,用户可以在其中输入以英尺为单位的测量距离的值。