带有圆形的Flutter SearchView揭示类似whatsapp的动画

时间:2019-05-29 11:28:33

标签: flutter flutter-layout flutter-animation

是否有Flutter实现或类似android java之类的库?

public void circleReveal(int viewID, int posFromRight, boolean containsOverflow, final boolean isShow)

{  
  final View myView = findViewById(viewID);

  ...
  if(containsOverflow)
 width-=getResources().getDimensionPixelSize(R.dimen.abc_action_button_min_width_overflow_material);

  int cx=width;
  int cy=myView.getHeight()/2;
  Animator anim;
  if(isShow)
    anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0,(float)width);
  else
    anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, (float)width, 0);

  anim.setDuration((long)220);
  anim.addListener(new AnimatorListenerAdapter() {
  @Override
  public void onAnimationEnd(Animator animation) {
    if(!isShow)
    {
      super.onAnimationEnd(animation);
      myView.setVisibility(View.INVISIBLE);
    }
  } 
 });
  if(isShow)
    myView.setVisibility(View.VISIBLE);
  anim.start();
}

0 个答案:

没有答案