AppBarSearch constructor

AppBarSearch({
  1. @required State<StatefulWidget>? state,
  2. Widget? title,
  3. String? hintText = "search...",
  4. VoidCallback? onPressed,
  5. TextEditingController? controller,
  6. ValueChanged<String>? onSubmitted,
  7. 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;
}