I want to try put TextFormField
in the row expanded widget, but I can’t seem to put TextFormField
anywhere there
Column(
children: [
ListTile(
title: Text('Full Name'),
subtitle: TextFormField(
decoration: const InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
hintText: 'Full Name',
),
),
),
SizedBox(
height: 5,
),
Row(
children: [
Expanded(
child: ListTile(
title: Text('Department'),
subtitle: TextFormField(
decoration: const InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
hintText: ' Department',
),
),),
),
SizedBox(
width: 5,
),
Expanded(
child:ListTile(
title: Text('Year Of Study'),
subtitle: TextFormField(
decoration: const InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(8))),
hintText: ' Year Of Study',
),
),),
),
],
)
],
),
This is one example of the code I find to put TextFormField
s side by side, but got this error:
The constructor being called isn't a const constructor.
Try removing 'const' from the constructor invocation.
TextFormField
‘s constructor isn’t being invoked with const
in this case. How do I fix this error?
2
Answers
You likely have a parent Widget with a
const
keyword; check theColumn
‘s parents and remove anyconst
until the issue is resolved.You can try this code your problem will be resolved you were using the one ListTile outside the row that is why that problem was occurring.