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

How can I implement the vertical scroll axis for Stack / Tinder Layout? #9

Closed
lavanoped opened this issue Aug 26, 2018 · 4 comments
Closed

Comments

@lavanoped
Copy link

lavanoped commented Aug 26, 2018

scrollDirection -> vertical doesn't seem to work for layouts STACK and TINDER.
Please do tell how organize the Stacks vertically if the scroll direction is made vertical.

Regards
Lavan

@jzoom
Copy link
Member

jzoom commented Aug 27, 2018

We've seperated the custom layout logic into custom_layout.dart .
https://github.com/best-flutter/flutter_swiper/blob/master/lib/src/custom_layout.dart

In order to implement vertical STACK and TINDER, flow the steps below:
1、Modify _onPanUpdate in this file ,handle the user gesture here ,
2、Modify '_StackViewState' and '_TinderState' in 'swiper.dart',handle the parameters in vertical direction.

  //length of the values array below
    _animationCount = 5;

    //Array below this line, '0' index is 1.0 ,witch is the first item show in swiper.
    _startIndex = -3;
    scales = [0.7, 0.8, 0.9, 1.0, 1.0];
    offsets = [-space, -space / 3 * 2, -space / 3, 0.0, _screenWidth];
    opacity = [0.0, 0.5, 1.0, 1.0, 1.0];
 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];
    offsetsX = [0.0, 0.0, 0.0, 0.0, _screenWidth, _screenWidth];
    offsetsY = [
      0.0,
      0.0,
      -5.0,
      -10.0,
      -15.0,
      -20.0,
    ];
    rotates = [0.0, 0.0, 0.0, 0.0, 20.0, 25.0];

These parameters offsetX and offsetY must be supplied in vertical direction .
We'll fix this issue in the next version.

@jzoom
Copy link
Member

jzoom commented Aug 28, 2018


@jzoom jzoom closed this as completed in 082a8b5 Aug 28, 2018
@lavanoped
Copy link
Author

It's perfect now, thank you so much!

@ghozay19
Copy link

It's perfect now, thank you so much!

hi I have some problem,
sometimes can scroll sometimes cannot.

but ya, it can't scroll vertical,

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

3 participants