瀏覽代碼

Minor bug fix

Neeraj Gupta 2 年之前
父節點
當前提交
1965588081
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      lib/ui/viewer/file/file_details_widget.dart

+ 8 - 5
lib/ui/viewer/file/file_details_widget.dart

@@ -52,20 +52,23 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
   bool _isImage = false;
   bool _isImage = false;
   late int _currentUserID;
   late int _currentUserID;
   bool showExifListTile = false;
   bool showExifListTile = false;
-  final hasLocationDataNotifer = ValueNotifier(false);
+  final ValueNotifier<bool> hasLocationData = ValueNotifier(false);
   final Logger _logger = Logger("_FileDetailsWidgetState");
   final Logger _logger = Logger("_FileDetailsWidgetState");
 
 
   @override
   @override
   void initState() {
   void initState() {
     debugPrint('file_details_sheet initState');
     debugPrint('file_details_sheet initState');
     _currentUserID = Configuration.instance.getUserID()!;
     _currentUserID = Configuration.instance.getUserID()!;
+    hasLocationData.value = widget.file.hasLocation;
     _isImage = widget.file.fileType == FileType.image ||
     _isImage = widget.file.fileType == FileType.image ||
         widget.file.fileType == FileType.livePhoto;
         widget.file.fileType == FileType.livePhoto;
+
     _exifNotifier.addListener(() {
     _exifNotifier.addListener(() {
       if (_exifNotifier.value != null && !widget.file.hasLocation) {
       if (_exifNotifier.value != null && !widget.file.hasLocation) {
         _updateLocationFromExif(_exifNotifier.value!).ignore();
         _updateLocationFromExif(_exifNotifier.value!).ignore();
       }
       }
     });
     });
+
     if (_isImage) {
     if (_isImage) {
       _exifNotifier.addListener(() {
       _exifNotifier.addListener(() {
         if (_exifNotifier.value != null) {
         if (_exifNotifier.value != null) {
@@ -142,9 +145,9 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
     if (FeatureFlagService.instance.isInternalUserOrDebugBuild()) {
     if (FeatureFlagService.instance.isInternalUserOrDebugBuild()) {
       fileDetailsTiles.addAll([
       fileDetailsTiles.addAll([
         ValueListenableBuilder(
         ValueListenableBuilder(
-          valueListenable: hasLocationDataNotifer,
-          builder: (context, bool hasLocationData, __) {
-            return hasLocationData
+          valueListenable: hasLocationData,
+          builder: (context, bool value, __) {
+            return value
                 ? Column(
                 ? Column(
                     children: [
                     children: [
                       LocationTagsWidget(
                       LocationTagsWidget(
@@ -248,7 +251,7 @@ class _FileDetailsWidgetState extends State<FileDetailsWidget> {
           pubMagicKeyLat: locationDataFromExif!.latitude,
           pubMagicKeyLat: locationDataFromExif!.latitude,
           pubMagicKeyLong: locationDataFromExif.longitude
           pubMagicKeyLong: locationDataFromExif.longitude
         });
         });
-        hasLocationDataNotifer.value = true;
+        hasLocationData.value = true;
       }
       }
     } catch (e, s) {
     } catch (e, s) {
       _logger.severe("Error while updating location from EXIF", e, s);
       _logger.severe("Error while updating location from EXIF", e, s);