SearchDelegate<T> constructor

SearchDelegate<T>({
  1. String? searchFieldLabel,
  2. TextInputType? keyboardType,
  3. TextInputAction textInputAction = TextInputAction.search,
})

Constructor to be called by subclasses which may specify searchFieldLabel, keyboardType and/or textInputAction.

{@tool sample}

class CustomSearchHintDelegate extends SearchDelegate {
  CustomSearchHintDelegate({
    String hintText,
  }) : super(
    searchFieldLabel: hintText,
    keyboardType: TextInputType.text,
    textInputAction: TextInputAction.search,
  );

  @override
  Widget buildLeading(BuildContext context) => Text("leading");

  @override
  Widget buildSuggestions(BuildContext context) => Text("suggestions");

  @override
  Widget buildResults(BuildContext context) => Text('results');

  @override
  List<Widget> buildActions(BuildContext context) => [];
}

{@end-tool}

Implementation

SearchDelegate({
  this.searchFieldLabel,
  this.keyboardType,
  this.textInputAction = TextInputAction.search,
});