59 lines
1.6 KiB
Dart
59 lines
1.6 KiB
Dart
part of 'field.dart';
|
|
|
|
class SearchTextField extends StatelessWidget {
|
|
final String hintText;
|
|
final IconData prefixIcon;
|
|
final TextEditingController? controller;
|
|
final Function()? onClear;
|
|
|
|
const SearchTextField({
|
|
super.key,
|
|
required this.hintText,
|
|
required this.prefixIcon,
|
|
this.controller,
|
|
this.onClear,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.fromLTRB(16, 0, 16, 16),
|
|
decoration: BoxDecoration(
|
|
color: AppColor.white,
|
|
borderRadius: BorderRadius.circular(25),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withOpacity(0.05),
|
|
blurRadius: 10,
|
|
offset: Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: TextField(
|
|
cursorColor: AppColor.primary,
|
|
controller: controller,
|
|
decoration: InputDecoration(
|
|
hintText: hintText,
|
|
hintStyle: TextStyle(color: AppColor.textLight, fontSize: 14),
|
|
disabledBorder: InputBorder.none,
|
|
enabledBorder: InputBorder.none,
|
|
errorBorder: InputBorder.none,
|
|
focusedBorder: InputBorder.none,
|
|
prefixIcon: Container(
|
|
margin: EdgeInsets.all(12),
|
|
width: 24,
|
|
height: 24,
|
|
decoration: BoxDecoration(
|
|
color: AppColor.primary,
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Icon(prefixIcon, color: AppColor.white, size: 14),
|
|
),
|
|
border: InputBorder.none,
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|