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; return gallery;
}, },
labelTextBuilder: (int index) { labelTextBuilder: (int index) {
return getMonthAndYear( try {
DateTime.fromMicrosecondsSinceEpoch( return getMonthAndYear(
_collatedFiles[index][0].creationTime!, DateTime.fromMicrosecondsSinceEpoch(
), _collatedFiles[index][0].creationTime!,
); ),
);
} catch (e) {
_logger.severe("label text builder failed", e);
return "";
}
}, },
thumbBackgroundColor: thumbBackgroundColor:
Theme.of(context).colorScheme.galleryThumbBackgroundColor, Theme.of(context).colorScheme.galleryThumbBackgroundColor,