animation property

(Widget Function(Widget child)?) animation

A function that return an Animation Widget to animate transition to and from SearchMode of AppBarWithSearchSwitch.

There are two prebuild animation widgets:

But you can build you own animation widget, if you want.

Usage of prebuilt animation widgets:

        appBar: AppBarWithSearchSwitch(
         // or customize:
         // animation: (child) => AppBarAnimationSlideLeft(child: child, milliseconds: 600, withFade: false, percents: 1.0,),
          appBarBuilder: (context) {
            return AppBar(
              title: Text(title),
              actions: const [

Usage of your own animation widget:

        appBar: AppBarWithSearchSwitch(
          animation: (child) {
            return AnimatedSwitcher(
              duration: Duration(milliseconds: 600),
              transitionBuilder: (Widget child, Animation<double> animation) {
                return FadeTransition(opacity: animation, child: child);
              child: child,
          appBarBuilder: (context) {


final Widget Function(Widget child)? animation;