I'm trying to create a new TextInput
widget for customizing TextFormField
but i can't customize labelText
. I need to send in constructor labelText
for my TextFormField
and show this String.
class TextInput extends StatelessWidget {
final TextEditingController textControler;
final String textLabelHint;
const TextInput({Key? key, required this.textControler,required this.textLabelHint}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 10.0),
child: TextFormField(
controller: textControler,
decoration: const InputDecoration(
border: OutlineInputBorder(),
labelText: textLabelHint,
),
),
);
}
}
But I have problem:
labelText: textLabelHint, //Invalid constant value.