Skip to content

tester.pumpAndSettle(...) times out when PhotoViewGallery is in widget tree #569

@cian-bayer

Description

@cian-bayer

I'm trying to test a widget that displays a PhotoViewGallery.builder(...) widget like this:

body: PhotoViewGallery.builder(
        onPageChanged: (index) => currentIndex = index,
        pageController: controller,
        scrollPhysics: const BouncingScrollPhysics(),
        builder: (BuildContext context, int index) {
          return PhotoViewGalleryPageOptions(
            imageProvider:
                Image.asset('${directory.path}${images[index].path}').image,
            initialScale: PhotoViewComputedScale.contained * 0.8,
            heroAttributes: PhotoViewHeroAttributes(tag: images[index].id),
          );
        },
        itemCount: images.length,
      ),

When testing, I call tester.pumpAndSettle(Duration(milliseconds: 100)) and it never settles. I've also tried calling just tester.pumpAndSettle(); many tester.pump() calls (with varying durations, anywhere from 100ms - 10000ms), followed by a single pumpAndSettle().

I'm fairly certain it's the PhotoViewGallery that's causing the issue because if I replace it with something simple like body: Text("test") the test passes just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions