Flutter 颤振动画:使用opencontainer进行showSearch

Flutter 颤振动画:使用opencontainer进行showSearch,flutter,flutter-animation,Flutter,Flutter Animation,在颤振的动画包中,使用容器变换动画的一个示例是 将搜索栏转换为扩展搜索 现在显示扩展搜索的常用方法是使用showSearch函数,我只知道通过搜索代理修改搜索动画 有没有办法将openContainer与showSearch一起使用?或者我应该创建自己的搜索页面,用openContainer打开,而不是依赖showSearch?在这里,我发现了一个可能很复杂的解决方案,因为在我们的SearchDelegate中,我们不能 Here I found a Solution that may be c

在颤振的
动画
包中,使用容器变换动画的一个示例是

将搜索栏转换为扩展搜索

现在显示扩展搜索的常用方法是使用
showSearch
函数,我只知道通过搜索代理修改搜索动画


有没有办法将
openContainer
showSearch
一起使用?或者我应该创建自己的搜索页面,用
openContainer
打开,而不是依赖
showSearch

在这里,我发现了一个可能很复杂的解决方案,因为在我们的SearchDelegate中,我们不能
Here I found a Solution that may be complex because in our SearchDelegate we can't 
implement animation implicitly.
We can change the package provided by flutter. GoTO 
<Flutter Sdk Path>\packages\flutter\lib\src\material\search.dart(Ex: 
E:\software\flutter\packages\flutter\lib\src\material\search.dart)
enter code here
Inside  Official Search.dart we can make changes accordingly...

Here what I have done to change the animation Duration and type of Animation itself...

To change the animation DUration: line no 341
  Duration get transitionDuration => const Duration(milliseconds: 700);//give your
// flexible number

To change the animation : line no 353
return your own animation type default there will be FadeTransition from line No 353-356 you can use SlideTransition, ScaleTransition in the place of FadeTransition
return SlideTransition(        //for slide transition return this instead of Fade 
 //Animation
               position: Tween<Offset>(
               begin: const Offset(0, -0.5),
               end: Offset.zero,
             ).animate(animation),
             child: child,
           );
  // ScaleTransition( //for scale transition uncomment this(ZoomIn and Zoom out)
   //   scale: Tween<double>(
   //               begin: 0.0,
   //               end: 1.0,
   //             ).animate(
   //               CurvedAnimation(
   //                 parent: animation,
   //                 curve: Curves.fastOutSlowIn,
   //               ),
   //             ),
   //             child: child,
   //           );
隐式实现动画。 我们可以更改颤振公司提供的包装。后藤 \软件包\flatter\lib\src\material\search.dart(例如: E:\software\flatter\packages\flatter\lib\src\material\search.dart) 在这里输入代码 在Official Search.dart中,我们可以相应地进行更改。。。 在这里我做了什么来改变动画的持续时间和类型的动画本身。。。 更改动画持续时间:第341行 Duration get transitionDuration=>const Duration(毫秒:700)//给你的 //弹性数 更改动画的步骤:第353行 返回您自己的动画类型默认将有第353-356行的FadeTransition。您可以使用SlideTransition、ScaleTransition代替FadeTransition return SlideTransition(//对于幻灯片转换,返回此值而不是淡入淡出 //动画 位置:吐温( 开始:常数偏移(0,-0.5), 结束:偏移0.0, ).制作动画(动画), 孩子:孩子, ); //ScaleTransition(//对于缩放转换,取消对此的注释(缩放和缩小) //音阶:吐温( //开始:0.0, //完:1.0,, //)。制作动画( //曲线化( //家长:动画, //曲线:Curves.FastOutSwowin, // ), // ), //孩子:孩子, // );
如果要将标签从搜索更改为自定义标签 在使用SearchDelegate扩展的类中提供标签 内部super()作为属性searchFieldLabel

  To Change the Label :
  class StoreSearch extends SearchDelegate<String> {
  // @override
  // TODO: implement searchFieldLabel
  StoreSearch()
    : super(
        searchFieldLabel: "StoreSearch",//provide your Label here
     );}
要更改标签:
类StoreSearch扩展了SearchDelegate{
//@覆盖
//TODO:实现searchFieldLabel
StoreSearch()
:超级(
searchFieldLabel:“StoreSearch”//在此处提供您的标签
);}

“还是我应该创建自己的搜索页面,用openContainer打开,而不是依赖showSearch?”-您似乎可以分享如何打开搜索以显示动画