AppBarSearch constructor
AppBarSearch({
- @required State<
StatefulWidget> ? state, - Widget? title,
- String? hintText = "search...",
- VoidCallback? onPressed,
- TextEditingController? controller,
- ValueChanged<
String> ? onSubmitted, - VoidCallback? onEditingComplete,
Implementation
AppBarSearch({
@required this.state,
this.title,
this.hintText = "search...",
this.onPressed,
this.controller,
this.onSubmitted,
this.onEditingComplete,
}) {
title ??= const Text("search...");
_hintText = hintText;
_onPressed = onPressed ?? _pressedFunc;
_appBarTitle = GestureDetector(
child: title,
onTap: _onPressed,
);
// title is now a GestureDetector widget.
title = _appBarTitle;
_onSubmitted = onSubmitted;
_onEditingComplete = onEditingComplete;
_icon = const Icon(Icons.search);
_textController = controller ?? TextEditingController();
// Flag indicating user tapped to initiate search.
_wasPressed = false;
}