CustomSearchBar constructor
const
CustomSearchBar({
- Key? key,
- TextEditingController? controller,
- FocusNode? focusNode,
- void onChanged()?,
- void onSearch()?,
- void onSubmitted()?,
- VoidCallback? onTap,
- VoidCallback? onClear,
- void onFocusChanged()?,
- VoidCallback? onVoiceSearch,
- SearchBarStyle style = SearchBarStyle.outlined,
- SearchBarAnimationType animationType = SearchBarAnimationType.fade,
- double? height,
- double? width,
- EdgeInsetsGeometry? padding,
- EdgeInsetsGeometry? contentPadding,
- EdgeInsetsGeometry? margin,
- double? borderRadius,
- double? borderWidth,
- double? iconPaddingLeft,
- double? iconPaddingRight,
- double? iconSpacing,
- Color? backgroundColor,
- Color? focusedBackgroundColor,
- Color? disabledBackgroundColor,
- Color? borderColor,
- Color? focusedBorderColor,
- Color? errorBorderColor,
- Color? textColor,
- Color? hintColor,
- Color? iconColor,
- Color? focusedIconColor,
- Color? disabledIconColor,
- Color? cursorColor,
- Color? shadowColor,
- Color? clearButtonColor,
- Color? clearButtonBackgroundColor,
- Color? loadingIndicatorColor,
- Widget? prefixIcon,
- Widget? suffixIcon,
- IconData? prefixIconData,
- IconData? suffixIconData,
- double? prefixIconSize,
- double? suffixIconSize,
- bool showPrefixIcon = true,
- bool showClearButton = true,
- bool showVoiceButton = false,
- Widget? clearIcon,
- Widget? voiceIcon,
- double? clearIconSize,
- IconData? voiceIconData,
- String? hintText,
- TextStyle? textStyle,
- TextStyle? hintStyle,
- double? fontSize,
- FontWeight? fontWeight,
- String? fontFamily,
- int? maxLength,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization? textCapitalization,
- bool autofocus = false,
- bool readOnly = false,
- bool enabled = true,
- bool enableSuggestions = true,
- bool autocorrect = true,
- int? debounceMs,
- bool hapticFeedback = true,
- bool closeKeyboardOnSubmit = true,
- bool clearOnSubmit = false,
- bool selectAllOnFocus = false,
- bool isLoading = false,
- bool hasError = false,
- String? errorText,
- TextStyle? errorTextStyle,
- EdgeInsetsGeometry? errorTextPadding,
- Duration? animationDuration,
- Curve? animationCurve,
- double? elevation,
- double? focusedElevation,
- Widget? loadingWidget,
- double? loadingIndicatorSize,
- double? loadingIndicatorStrokeWidth,
- double? clearButtonPadding,
- BoxShape? clearButtonShape,
- List<
TextInputFormatter> ? inputFormatters, - Iterable<
String> ? autofillHints, - String? semanticLabel,
- bool? enableSecurity,
Implementation
const CustomSearchBar({
super.key,
// ============== Controllers & Focus ==============
this.controller,
this.focusNode,
// ============== Callbacks ==============
this.onChanged,
this.onSearch,
this.onSubmitted,
this.onTap,
this.onClear,
this.onFocusChanged,
this.onVoiceSearch,
// ============== Style Configuration ==============
this.style = SearchBarStyle.outlined,
this.animationType = SearchBarAnimationType.fade,
// ============== Size Configuration ==============
this.height,
this.width,
this.padding,
this.contentPadding,
this.margin,
this.borderRadius,
this.borderWidth,
this.iconPaddingLeft,
this.iconPaddingRight,
this.iconSpacing,
// ============== Color Configuration ==============
this.backgroundColor,
this.focusedBackgroundColor,
this.disabledBackgroundColor,
this.borderColor,
this.focusedBorderColor,
this.errorBorderColor,
this.textColor,
this.hintColor,
this.iconColor,
this.focusedIconColor,
this.disabledIconColor,
this.cursorColor,
this.shadowColor,
this.clearButtonColor,
this.clearButtonBackgroundColor,
this.loadingIndicatorColor,
// ============== Icon Configuration ==============
this.prefixIcon,
this.suffixIcon,
this.prefixIconData,
this.suffixIconData,
this.prefixIconSize,
this.suffixIconSize,
this.showPrefixIcon = true,
this.showClearButton = true,
this.showVoiceButton = false,
this.clearIcon,
this.voiceIcon,
this.clearIconSize,
this.voiceIconData,
// ============== Text Configuration ==============
this.hintText,
this.textStyle,
this.hintStyle,
this.fontSize,
this.fontWeight,
this.fontFamily,
this.maxLength,
// ============== Keyboard Configuration ==============
this.keyboardType,
this.textInputAction,
this.textCapitalization,
this.autofocus = false,
this.readOnly = false,
this.enabled = true,
this.enableSuggestions = true,
this.autocorrect = true,
// ============== Behavior Configuration ==============
this.debounceMs,
this.hapticFeedback = true,
this.closeKeyboardOnSubmit = true,
this.clearOnSubmit = false,
this.selectAllOnFocus = false,
// ============== State Configuration ==============
this.isLoading = false,
this.hasError = false,
this.errorText,
this.errorTextStyle,
this.errorTextPadding,
// ============== Animation Configuration ==============
this.animationDuration,
this.animationCurve,
this.elevation,
this.focusedElevation,
// ============== Loading Configuration ==============
this.loadingWidget,
this.loadingIndicatorSize,
this.loadingIndicatorStrokeWidth,
// ============== Clear Button Configuration ==============
this.clearButtonPadding,
this.clearButtonShape,
// ============== Input Configuration ==============
this.inputFormatters,
this.autofillHints,
// ============== Accessibility ==============
this.semanticLabel,
// ============== Security ==============
this.enableSecurity,
});