I want to increase the second TextField's height(Inside Stack). I have wrapped it in Container, and set the height to 500
, but it doesn't make any difference.
class _ABC extends State<ABC>{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Add Data'),
actions: <Widget>[
IconButton(
icon: Icon(Icons.done),
onPressed: () {},
)
],
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextField(
style: TextStyle(fontSize: 12.0),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0))),
hintText: Localization.of(context).name,
labelText: Localization.of(context).name,
),
),
SizedBox(
height: 15.0,
),
Stack(
children: <Widget>[
Container(
width: double.infinity,
height: 500.0,
child: TextField(
style: TextStyle(fontSize: 12.0),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0))),
hintText: Localization.of(context).name,
labelText: Localization.of(context).name,
),
)),
Positioned(
left: 5.0,
child: Icon(Icons.camera),
)
],
)
])));
}
The height of a TextField is set either with
1) Expand to fill it's holder with expands or
2) Set it to a fixed height in lines, with maxlines.
Here's what you need to fill the container:
Container(
width: double.infinity,
height: 500.0,
color: Colors.amber,
child: TextField(
expands: true,
maxLines: null,
style: TextStyle(fontSize: 12.0),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(5.0))),
hintText: Localization.of(context).name,
labelText: Localization.of(context).name,
),
),
)