Skip to content

Instantly share code, notes, and snippets.

@SuvidhaMalaviya
Created April 24, 2022 10:47
Show Gist options
  • Save SuvidhaMalaviya/d7c9386c9e93f93d930e68242ecb8580 to your computer and use it in GitHub Desktop.
Save SuvidhaMalaviya/d7c9386c9e93f93d930e68242ecb8580 to your computer and use it in GitHub Desktop.
how to make custom TextField in flutter.
Widget getCustomTextField(
TextEditingController _controller, String hintText) {
return Container(
height: 65,
child: Padding(
padding: EdgeInsets.only(top: 8, bottom: 8),
child: TextFormField(
controller: _controller,
decoration: InputDecoration(
isDense: true,
fillColor: Colors.grey,
filled: true,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.grey, width: 1),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.grey, width: 1),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.grey, width: 1),
),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.grey, width: 1),
),
suffixIcon: Image.asset(
Icons.help,
color: Colors.blue,
height: 10,
width: 10,
),
hintText: hintText,
hintStyle: TextStyle(
fontSize: getFontSize(16),
color: hintColor,
letterSpacing: 0.22,
),
),
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment