Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiperLayout.TINDER 模式_animationCount 写死成5,导致一个item时,还能滑动。 #128

Open
sail-coder opened this issue Sep 4, 2019 · 0 comments

Comments

@sail-coder
Copy link

@OverRide
void afterRender() {
super.afterRender();

_startIndex = -3;
_animationCount = 5;
opacity = [0.0, 0.9, 0.9, 1.0, 0.0, 0.0];
scales = [0.80, 0.80, 0.85, 0.90, 1.0, 1.0, 1.0];
rotates = [0.0, 0.0, 0.0, 0.0, 20.0, 25.0];
_updateValues();

}

后续的事件处理为:
Widget _buildAnimation(BuildContext context, Widget w) {
List list = [];

double animationValue = _animation.value;

for (int i = 0; i < _animationCount; ++i) {
  int realIndex = _currentIndex + i + _startIndex;
  realIndex = realIndex % widget.itemCount;
  if (realIndex < 0) {
    realIndex += widget.itemCount;
  }

  list.add(_buildItem(i, realIndex, animationValue));
}

return new GestureDetector(
  behavior: HitTestBehavior.opaque,
  onPanStart: _onPanStart,
  onPanEnd: _onPanEnd,
  onPanUpdate: _onPanUpdate,
  child: new ClipRect(
    child: new Center(
      child: _buildContainer(list),
    ),
  ),
);

}

导致item为1时还可以进行滑动。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant