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

Long image scroll #674

Closed
FrancescoXD opened this issue May 1, 2024 · 6 comments
Closed

Long image scroll #674

FrancescoXD opened this issue May 1, 2024 · 6 comments

Comments

@FrancescoXD
Copy link

FrancescoXD commented May 1, 2024

Platforms

Android

Description

When I have a very long image I want that it takes all the width space and that it scrolls also.

My code

ExtendedImage.network(
                imageUrl,
                fit: BoxFit.fitWidth,
                mode: ExtendedImageMode.gesture,
                initGestureConfigHandler: (ExtendedImageState state) {
                  return GestureConfig(
                    minScale: 0.9,
                    maxScale: 3,
                    initialScale: 1.0,
                    inPageView: true,
                    initialAlignment: InitialAlignment.center,
                  );
                },
              ),

Try do it

I tried with SingleChildScrollView() and it works the way I want, but the gestures don't work. Removing the SingleChildScrollView() it takes only a small column all to the left.

@zmtzawqlp
Copy link
Member

don't set BoxFit.fitWidth, and you should set initialScale to matchwidth

@FrancescoXD
Copy link
Author

how should I match the initialScale to the screen's width? I tried with MediaQuery of size.width, but it doesn't work.

@FrancescoXD
Copy link
Author

ExtendedImage.network(
                  imageUrl,
                  mode: ExtendedImageMode.gesture,
                  initGestureConfigHandler: (ExtendedImageState state) {
                    return GestureConfig(
                      minScale: 0.9,
                      maxScale: MediaQuery.of(context).size.width * 3,
                      initialScale: MediaQuery.of(context).size.width,
                      inPageView: true,
                      initialAlignment: InitialAlignment.center,
                    );
                  },
                ),

I tried with this but the image is very zoomed.

@zmtzawqlp
Copy link
Member

you can use this method

@FrancescoXD
Copy link
Author

Do I have to copy all the function code and put everything on mine and test it?

@zmtzawqlp
Copy link
Member

You should calculate the initial scale so that the width of the image fits perfectly, allowing you to scroll up and down

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

2 participants