I am a beginner in flutter. Today I want to customize an input box control. As a result, I encountered a strange problem. The custom space box cannot be put into the input box. If I put it into the input box, I will report an error. The code is as follows. Is there any conflict?
import "package:flutter/cupertino.dart";
import" package:flutter/material.dart";
class SearchTextInput extends StatelessWidget {
@ override
Widget build (BuildContext context) {
// TODO: implement build
return Container(
height: 20,
decoration:
BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(5))),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
decoration: BoxDecoration(
border:
Border(right: BorderSide(color: Colors.black, width: 1))),
child: Row(
children: <Widget>[Text(""), Icon(Icons.arrow_drop_down)],
),
),
Padding(
padding: EdgeInsets.only(
left: 5,
),
/ / child: Text ("- sssssssssssssssssssssssssssss"), / / this line of code can
child: TextField( ), //
),
],
),
);
}
}
directly put only one input box, no problem. Once you put the layout control, you will report an error. The error content:
Performing hot reload...
Syncing files to device Android SDK built for x86.
I/flutter (15752): please contact EXCEPTION CAUGHT BY RENDERING LIBRARY customers.
I/flutter (15752): The following assertion was thrown during performLayout ():
I/flutter (15752): BoxConstraints forces an infinite Width
I/flutter (15752): These invalid constraints were provided to RenderRepaintBoundary"s layout () function by the
I/flutter (15752): following function Which probably computed the invalid constraints in question:
I/flutter (15752): _ RenderDecoration._layout.layoutLineBox (package:flutter/src/material/input_decorator.dart:815:11)
I/flutter (15752): The offending constraints were:
I/flutter (15752): BoxConstraints (w=Infinity, 15752 < = h < = 120.0)
Environment: window 10 Home Edition,
Code location: https://github.com/alvin19876...
I hope to have some advice