getClearButton method
prefix clear button in search bar for clearing inputBox.
Implementation
Widget getClearButton() {
if (!showClearButton) {
return const SizedBox.shrink();
}
return Padding(
padding: EdgeInsets.only(right: widget.padding?.right ?? 12, left: 6),
child: InkWell(
borderRadius: BorderRadius.circular(20),
child: widget.suffixChild ??
UFUInputBoxClearIcon(
type: widget.type,
cancelButtonColor: widget.cancelButtonColor,
cancelButtonSize: widget.cancelButtonSize,
),
onTap: () {
if (widget.onTapSuffix != null) {
widget.onTapSuffix!();
} else {
inputBoxController.controller.clear();
if (widget.onChanged != null) widget.onChanged!("");
setClearButtonState("");
}
},
),
);
}