forked from firka/flutter
Unbounded TextField width error (#30796)
Improve the error message shown when a TextField ends up with an unbounded width.
This commit is contained in:
committed by
GitHub
parent
6a22f41239
commit
fee1d3db90
@@ -834,6 +834,17 @@ class _RenderDecoration extends RenderBox {
|
||||
// This method applies layout to all of the renderers except the container.
|
||||
// For convenience, the container is laid out in performLayout().
|
||||
_RenderDecorationLayout _layout(BoxConstraints layoutConstraints) {
|
||||
assert(
|
||||
layoutConstraints.maxWidth < double.infinity,
|
||||
'An InputDecorator, which is typically created by a TextField, cannot '
|
||||
'have an unbounded width.\n'
|
||||
'This happens when the parent widget does not provide a finite width '
|
||||
'constraint. For example, if the InputDecorator is contained by a Row, '
|
||||
'then its width must be constrained. An Expanded widget or a SizedBox '
|
||||
'can be used to constrain the width of the InputDecorator or the '
|
||||
'TextField that contains it.',
|
||||
);
|
||||
|
||||
// Margin on each side of subtext (counter and helperError)
|
||||
final Map<RenderBox, double> boxToBaseline = <RenderBox, double>{};
|
||||
final BoxConstraints boxConstraints = layoutConstraints.loosen();
|
||||
|
||||
Reference in New Issue
Block a user