searchBar static method
Widget
searchBar({
- String? hintText,
- TextEditingController? controller,
- dynamic onChanged()?,
- VoidCallback? onClear,
- GlassType type = GlassType.frosted,
Glass search bar
Implementation
static Widget searchBar({
String? hintText,
TextEditingController? controller,
Function(String)? onChanged,
VoidCallback? onClear,
GlassType type = GlassType.frosted,
}) {
return GlassContainer(
type: type,
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
child: Row(
children: [
Icon(Icons.search, color: Colors.white70, size: 20.sp),
SizedBox(width: 12.w),
Expanded(
child: TextField(
controller: controller,
onChanged: onChanged,
style: AppTextThemes.bodyMedium(color: Colors.white),
decoration: InputDecoration(
hintText: hintText ?? 'Search...',
hintStyle: AppTextThemes.bodyMedium(color: Colors.white60),
border: InputBorder.none,
isDense: true,
contentPadding: EdgeInsets.zero,
),
),
),
if (onClear != null) ...[
SizedBox(width: 8.w),
GestureDetector(
onTap: onClear,
child: Icon(Icons.clear, color: Colors.white70, size: 18.sp),
),
],
],
),
);
}