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

The crop box position jumps to the center position of the image when scrolling the whole page #577

Open
ElhamM7518 opened this issue May 14, 2023 · 1 comment

Comments

@ElhamM7518
Copy link

Version

6.3.2

Platforms

Android, iOS, Web

Device Model

Web browsers, iOS devices, Android devices

flutter info

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.9, on Microsoft Windows [Version 10.0.22000.1936], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2022.2)
[√] VS Code (version 1.78.2)
[√] Connected device (3 available)
[√] HTTP Host Availability

How to reproduce?

I found this bug when I put the ExtendedImage widget, inside a Column widget that it's wrapped with a SingleChildScrollView.

When I want to scroll the page, outside of the ExtendedImage area, the page is scrolled. But the position of the Crop box on the image is changed immediately and it jumps to the center of the image, while it keeps its selected zoom value.

Logs

No response

Example code (optional)

ValueListenableBuilder<bool>(
        valueListenable: isMouseHoveringCropSection,
        child: SizedBox.expand(
        child: ColoredBox(
          color: const Color(0xFFF7F7FA),
          child: SingleChildScrollView(
            controller: scrollController,
            child: Column(
                children: [
                  MouseRegion(
                    onEnter: (event) {
                      preventZoom.enable();
                      isMouseHoveringCropSection.value = true;
                    },
                    onExit: (event) {
                      preventZoom.disable();
                      isMouseHoveringCropSection.value = false;
                    },
                    child: Container(
                      width: 200,
                      height: 200,
                      clipBehavior: Clip.hardEdge,
                      decoration: const BoxDecoration(),
                      child: ExtendedImage.memory(
                        widget.image,
                        fit: BoxFit.contain,
                        clipBehavior: Clip.hardEdge,
                        isAntiAlias: true,
                        cacheRawData: true,
                        mode: ExtendedImageMode.editor,
                        extendedImageEditorKey: editorKey,
                        initEditorConfigHandler: (state) {
                          return EditorConfig(
                            maxScale: 4,
                            cropAspectRatio: 1,
                            cornerSize: Size(16.dp, 2.dp),
                            editorMaskColorHandler: (context, pointerDown) =>
                                editorMaskColor,
                          );
                        },
                      ),
                    ),
                  ),
                  SizedBox(
                    height: 24,
                  ),
                ],
              ),
          ),
        ),
      ),
        builder: (context, isMouseHoveringCropSection, child) {
          return ScrollConfiguration(
            behavior: ScrollConfiguration.of(context).copyWith(
              physics: isMouseHoveringCropSection
                  ? const NeverScrollableScrollPhysics()
                  : null,
            ),
            child: child!,
          );
        },
      );

Contact

No response

@zmtzawqlp
Copy link
Member

can you provide a runnable demo to reproduce it?

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