Handle error in label text builder

This commit is contained in:
Neeraj Gupta 2023-01-09 16:19:48 +05:30
parent 6bcadeda0e
commit 44c348256d
No known key found for this signature in database
GPG key ID: 3C5A1684DC1729E1

View file

@ -258,11 +258,16 @@ class _GalleryState extends State<Gallery> {
return gallery;
},
labelTextBuilder: (int index) {
return getMonthAndYear(
DateTime.fromMicrosecondsSinceEpoch(
_collatedFiles[index][0].creationTime!,
),
);
try {
return getMonthAndYear(
DateTime.fromMicrosecondsSinceEpoch(
_collatedFiles[index][0].creationTime!,
),
);
} catch (e) {
_logger.severe("label text builder failed", e);
return "";
}
},
thumbBackgroundColor:
Theme.of(context).colorScheme.galleryThumbBackgroundColor,