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.
I'm trying to test a widget that displays a
PhotoViewGallery.builder(...)widget like this:When testing, I call
tester.pumpAndSettle(Duration(milliseconds: 100))and it never settles. I've also tried calling justtester.pumpAndSettle(); manytester.pump()calls (with varying durations, anywhere from 100ms - 10000ms), followed by a singlepumpAndSettle().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.