app_bar_with_search_switch library
AppBar with search switch
An AppBar with switch into search field.
A simple usage example:
//...
@override
Widget build(BuildContext context) {
return Scaffold(
//
// *** The Widget AppBarWithSearchSwitch
//
appBar: AppBarWithSearchSwitch(
onChanged: (text) {
// update you provider here
// searchText.value = text;
}, // onSubmitted: (text) => searchText.value = text,
appBarBuilder: (context) {
return AppBar(
title: Text('Example '),
actions: [
AppBarSearchButton(),
// or
// IconButton(onPressed: AppBarWithSearchSwitch.of(context)?startSearch, icon: Icon(Icons.search)),
],
);
},
),
// search in body by any way you want, example:
body: AppBarOnEditListener(builder: (context) { /* your code here */ } ),
);
}
Classes
- AppBarAnimationSlideDown
-
The Slide down animation for AppBarWithSearchSwitch.
animation
- AppBarAnimationSlideLeft
-
The slide left animation for AppBarWithSearchSwitch.
animation
- AppBarOnEditListener
- Listen on edit events of AppBarWithSearchSwitch of Scaffold and call builder.
- AppBarOnSubmitListener
- Listen on submit events of AppBarWithSearchSwitch of Scaffold and call builder.
- AppBarSearchButton
- A default implementation of Search button for AppBarWithSearchSwitch.
- AppBarSpeechButton
- Button that will activate Speech to text recognition for AppBarWithSearchSwitch.
- AppBarWithSearchFinder
- Allow access to AppBarWithSearchSwitch everywhere in Scaffold.
- AppBarWithSearchSwitch
- The AppBar that can switch into search field.
- SpeechSubBar
- Indicator(and controller) shown when speech recognition is active.
Functions
-
backgroundBoxDecoration(
BuildContext context) → BoxDecoration - Default BoxDecoration with LinearGradient shown during transition.
-
innerStartListening(
{required SpeechToText speech, required ValueNotifier< bool> isListening, required ValueNotifier<String> textNotifier}) → Future<void> -
This function should only be used inside AppBarWithSearchSwitch.
speechSubBar
,