badjio / skeletons

A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.
BSD 3-Clause "New" or "Revised" License
73 stars 88 forks source link

Crash in Android emulator, not in device #4

Open BenoitDuffez opened 1 year ago

BenoitDuffez commented 1 year ago

Hi, first, thanks for this, it's very cool.

I ran into an issue where a skeleton makes an emulator crash completely (SIGSEGV), I'm assuming because of a flutter bug (flutter should not crash this bad). Yet, since it's caused by a skeleton, I'm giving my feedback here. More details on my SO post: https://stackoverflow.com/questions/75880181/emulator-crashes-when-ran-in-a-container

I was running emulators on a server with the latest Debian, SDK, emulator at that time. The emulator would start, I'd install the app over ADB, start it with an intent to load a specific screen that contained a network image that had a skeleton as placeholder during download. This crashed the emulator. It worked fine on my device!

The workaround was to use a circular progress indicator placeholder instead:

 class MyNetworkImageWrapper extends CachedNetworkImage {
   MyNetworkImageWrapper(String imageUrl, {super.key, bool isThumbnail = false})
       : super(
           imageUrl: getImage(imageUrl, isThumbnail),
-          placeholder: (context, url) => SkeletonAvatar(
-            style: SkeletonAvatarStyle(
-              width: double.infinity,
-              minHeight: MediaQuery.of(context).size.height / 8,
-              maxHeight: MediaQuery.of(context).size.height / 3,
-            ),
-          ),
-        );
+          placeholder: (context, url) => const SizedBox(
+                height: 32.0,
+                width: 32.0,
+                child: CircularProgressIndicator(color: Colors.tealAccent),
+              ));
 }

More details on the SO post. I don't have interesting traces to show, so debugging this will be impossible I guess. I still wanted to log this here, just in case.