Instead of putting the `RaisedButton` in a `ConstrainedBox`, you can wrap it in an `Expanded` widget within a `Row` like this:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TextFormField(),
TextFormField(),
Row(
children: <Widget>[
Expanded(
child: RaisedButton(child: Text("button"), onPressed: () {}),
),
],
),
],
),
),
),
),
);
}
}
The `Row` will create a horizontal row, and the `Expanded` widget will make sure its child will fill as much space as possible.
Wrap BOTH your `Container` and `TextFormField` inside a `Flexible` widget.
[![enter image description here][1]][1]
Widget boxText = new Flexible(child: new Container(
decoration: new BoxDecoration(
border: new Border.all(
color: Colors.cyan[100],
width: 3.0,
style: BorderStyle.solid,
),
),
margin: new EdgeInsets.all(5.0),
padding: new EdgeInsets.all(8.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
'Text',
style: null,
),
new Text(
'Text',
style: null,
),
new Flexible (child: new TextFormField(
decoration: const InputDecoration(
hintText: '',
labelText: 'label',
),
obscureText: true,
),),
],
),
));
[1]: https://i.stack.imgur.com/Qexpu.png