OutlinedInputBorder cannot accept a linear gradient for its color. I would like the border of the textFormField to be a gradient when the user clicks into it.
Here is my attempt. The border does not change.
GestureDetector(
onTap: () {
setState(() {
borderFocused = true;
});
},
child: Container(
decoration: borderFocused
? const BoxDecoration(
border: GradientBoxBorder(
gradient: LinearGradient(
colors: [
Color(0xff45a7f5),
Color(0xff76c479)
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
)))
: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color.fromARGB(
30, 192, 192, 192)))),
child: TextFormField(
cursorColor: Color.fromARGB(255, 192, 192, 192),
style: const TextStyle(
color: Color.fromARGB(255, 192, 192, 192)),
decoration: textInputDecoration.copyWith(
labelStyle: const TextStyle(
color: Color.fromARGB(255, 192, 192, 192)),
hintText: "Email",
prefixIcon: Icon(
Icons.email,
color: Theme.of(context).primaryColor,
)),