Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/src/helpers/await_images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ extension AwaitImages on WidgetTester {
for (final element in find.byType(DecoratedBox).evaluate().toList()) {
final widget = element.widget as DecoratedBox;
final decoration = widget.decoration;
if (decoration is BoxDecoration) {
final image = decoration.image?.image;
if (image != null) {
await precacheImage(image, element);
await pump();
}
final image = switch (decoration) {
BoxDecoration() => decoration.image?.image,
ShapeDecoration() => decoration.image?.image,
_ => null,
};
if (image != null) {
await precacheImage(image, element);
await pump();
}
}
});
Expand Down
Loading