textField method Null safety
- String title,
- TextEditingController controller,
- BuildContext context,
- Color usernameTextFieldBorderColor,
- bool obscure
It creates a textfield. It takes a title
to be displayed above the
textfield, a controller
, a usernameTextFieldBorderColor
and weather
it should be obscure
or not.
Returns a Column
.
Implementation
static Column textField(String title, TextEditingController controller, BuildContext context, Color usernameTextFieldBorderColor, bool obscure){
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
width: Sizes.getUserInputSize(context).width,
height: Sizes.getPixelSize(0.02975167,context),
child: Text(title, style: Theme.of(context).textTheme.headline4),
),
Separators.verticalSeparator(0.00922296518, context), // Original: 8
SizedBox(
width: Sizes.getUserInputSize(context).width,
height: Sizes.getUserInputSize(context).height,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: CustomColors.userInputColors()
),
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
),
child: TextField(
obscureText: obscure,
style: const TextStyle(color: Colors.white),
decoration: InputDecoration(
hintText: '',
contentPadding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
enabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: usernameTextFieldBorderColor, width: 1.0),
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
),
focusedBorder: OutlineInputBorder(
borderSide:
BorderSide(color: usernameTextFieldBorderColor, width: 1),
borderRadius: const BorderRadius.all(Radius.circular(10.0)),
),
),
controller: controller,
),
),
),
Separators.verticalSeparator(0.0288217662, context),
]
);
}