I want my elevatedbutton to align with same height as another container inside a row. I tried to use expanded but it seems like expanded doesn't do anything to the height with the elevated button.
Here's my code
Row(
children: [
Container(
width: width / 2,
child: TextFormField(
decoration: const InputDecoration(
labelText: 'Date picker',
border: OutlineInputBorder()),
),
),
Expanded(
child: ElevatedButton(
onPressed: () => (displayDatePicker(context)),
child: const Text("Pick Date")),
),
],
),
Is there a way to achieve that without specifically setting the height of the elevated button using container or sizedbox?
To have multiple line, I am using IntrinsicHeight
.
IntrinsicHeight(
child: Row(
children: [
SizedBox(
width: 222,
child: TextFormField(
maxLines: 33,
minLines: 1,
decoration: const InputDecoration(
labelText: 'Date picker', border: OutlineInputBorder()),
),
),
Expanded(
//to grab width
child: FractionallySizedBox(
heightFactor: 1,
child: ElevatedButton(
onPressed: () {},
child: const Text("Pick Date"),
),
),
),
],
),
),
The default material size for TextFiled height is 48px, you can set the height on ElevatedButton using style or SizedBox
.
Row(
children: [
Container(
width: 222,
child: TextFormField(
decoration: const InputDecoration(
labelText: 'Date picker', border: OutlineInputBorder()),
),
),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
fixedSize: Size.fromHeight(48)),
onPressed: () {},
child: const Text("Pick Date")),
),
],
),