I would like to create a label on a Textfield that remains fixed in position. I have an app on my phone which has labels as shown below, and am trying to design something similar:
As seen, the labels are always there fixed in position whether someone typed in the field or not. I typed 'Jay' in the Customer Contact Field
With my current code the label starts inside the field then moves to hang at the border. Or maybe its not possible with flutter?
child:TextField(
decoration: InputDecoration(
labelText: 'Customer Contact')),
You can add Text
and TextField
into Column
widget to achieve this:
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text('Customer Contact', textAlign: TextAlign.left),
TextField(
cursorColor: Colors.white,
decoration: InputDecoration(hintText: 'Enter here'),
)
],
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With