How to get height of a TextFormField
Date : March 29 2020, 07:55 AM
this will help You can get the size of any widgets using context.size. You can get a specific widget's context by setting a GlobalKey on the desired widget.
|
Flutter increase height of TextFormField
Date : March 29 2020, 07:55 AM
To fix this issue Just adjust the contentPadding in InputDecoration. final email = TextFormField(
keyboardType: TextInputType.emailAddress,
autofocus: false,
initialValue: 'sathyabaman@gmail.com',
style: new TextStyle(fontWeight: FontWeight.normal, color: Colors.white),
decoration: InputDecoration(
hintText: 'Email',
contentPadding: new EdgeInsets.symmetric(vertical: 25.0, horizontal: 10.0),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)),
),
);
|
Validator error message changes TextFormField's height
Date : March 29 2020, 07:55 AM
To fix this issue In your Code - you need to comment out the 40 height given to each container. Container(
// height: 40.0,
child: _createTextFormField(
loginEmailController,
Icons.alternate_email,
"Email Adress",
false,
TextInputType.emailAddress),
),
Container(
// height: 40.0,
child: _createTextFormField(loginPasswordController, Icons.lock,
"Password", true, TextInputType.text),
),
contentPadding:
EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
|
How to increase Card elevation when TextFormField focused?
Date : December 25 2020, 12:01 PM
Hope that helps The TextFormField has a property called focusNode. Here is an example on how it can be used.
class MyClass extends StatefulWidget {
@override
_MyClassState createState() => new _MyClassState();
}
class _MyClassState extends State<MyClass> {
FocusNode _focusA = new FocusNode();
FocusNode _focusB = new FocusNode();
int _elevation = 5;
@override
void initState() {
super.initState();
_focusA.addListener(_onFocusChange);
_focusB.addListener(_onFocusChange);
}
void _onFocusChange(){
if (_focusA.hasFocus || _focusB.hasFocus)
setState(() => _elevation = 10);
else
setState(() => _elevation = 10);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 25, vertical: 30),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10),
),
elevation: _elevation,
child: Column(
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: TextFormField(
focusNode: _focusA,
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
child: TextFormField(
focusNode: _focusB,
),
),
],
),
),
),
);
}
}
|
Proper HTML alignment/sizing of two adjacent 50%-width/equal height fieldsets with a 100%-width below?
Date : March 29 2020, 07:55 AM
|