With this, When the user presses the email or password text field, its border color change from grey to green.
Look at the screenshot, and code - below the screenshot
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:insta/utils/colors.dart';
class CustomTextField extends StatelessWidget {
final TextEditingController controller;
final String hintText;
final Icon icon;
const CustomTextField({
Key? key,
required this.controller,
required this.hintText,
required this.icon,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
autocorrect: false,
autofocus: false,
enableSuggestions: false,
style: GoogleFonts.poppins(
fontWeight: FontWeight.w600,
fontSize: 16,
color: Colors.white,
),
decoration: InputDecoration(
contentPadding: EdgeInsets.all(15.0),
border: InputBorder.none,
prefixIcon: icon,
hintText: hintText,
hintStyle: GoogleFonts.poppins(
fontWeight: FontWeight.w600,
fontSize: 16,
color: Colors.white,
),
filled: true,
fillColor: Colors.grey.shade700,
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(color: maincolor),
borderRadius: BorderRadius.circular(25),
),
enabledBorder: UnderlineInputBorder(
borderSide: const BorderSide(color: Colors.grey),
borderRadius: BorderRadius.circular(25),
),
),
);
}
}
Comments
Post a Comment