|
@@ -3,12 +3,13 @@ import 'package:flutter/material.dart';
|
|
import 'package:flutter_map/flutter_map.dart';
|
|
import 'package:flutter_map/flutter_map.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/shared/models/asset.dart';
|
|
import 'package:immich_mobile/shared/models/asset.dart';
|
|
|
|
+import 'package:immich_mobile/shared/ui/drag_sheet.dart';
|
|
import 'package:openapi/api.dart';
|
|
import 'package:openapi/api.dart';
|
|
import 'package:path/path.dart' as p;
|
|
import 'package:path/path.dart' as p;
|
|
import 'package:latlong2/latlong.dart';
|
|
import 'package:latlong2/latlong.dart';
|
|
import 'package:immich_mobile/utils/bytes_units.dart';
|
|
import 'package:immich_mobile/utils/bytes_units.dart';
|
|
|
|
|
|
-class ExifBottomSheet extends ConsumerWidget {
|
|
|
|
|
|
+class ExifBottomSheet extends HookConsumerWidget {
|
|
final Asset assetDetail;
|
|
final Asset assetDetail;
|
|
|
|
|
|
const ExifBottomSheet({Key? key, required this.assetDetail})
|
|
const ExifBottomSheet({Key? key, required this.assetDetail})
|
|
@@ -65,6 +66,8 @@ class ExifBottomSheet extends ConsumerWidget {
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ final textColor = Theme.of(context).primaryColor;
|
|
|
|
+
|
|
ExifResponseDto? exifInfo = assetDetail.remote?.exifInfo;
|
|
ExifResponseDto? exifInfo = assetDetail.remote?.exifInfo;
|
|
|
|
|
|
buildLocationText() {
|
|
buildLocationText() {
|
|
@@ -72,120 +75,125 @@ class ExifBottomSheet extends ConsumerWidget {
|
|
"${exifInfo?.city}, ${exifInfo?.state}",
|
|
"${exifInfo?.city}, ${exifInfo?.state}",
|
|
style: TextStyle(
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
fontSize: 12,
|
|
- color: Colors.grey[200],
|
|
|
|
fontWeight: FontWeight.bold,
|
|
fontWeight: FontWeight.bold,
|
|
|
|
+ color: textColor,
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
- return Padding(
|
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8),
|
|
|
|
- child: ListView(
|
|
|
|
- children: [
|
|
|
|
- if (exifInfo?.dateTimeOriginal != null)
|
|
|
|
- Text(
|
|
|
|
- DateFormat('date_format'.tr()).format(
|
|
|
|
- exifInfo!.dateTimeOriginal!.toLocal(),
|
|
|
|
- ),
|
|
|
|
- style: TextStyle(
|
|
|
|
- color: Colors.grey[400],
|
|
|
|
- fontWeight: FontWeight.bold,
|
|
|
|
- fontSize: 14,
|
|
|
|
- ),
|
|
|
|
- ),
|
|
|
|
- Padding(
|
|
|
|
- padding: const EdgeInsets.only(top: 16.0),
|
|
|
|
- child: Text(
|
|
|
|
- "exif_bottom_sheet_description",
|
|
|
|
- style: TextStyle(
|
|
|
|
- color: Colors.grey[500],
|
|
|
|
- fontSize: 11,
|
|
|
|
- ),
|
|
|
|
- ).tr(),
|
|
|
|
- ),
|
|
|
|
-
|
|
|
|
- // Location
|
|
|
|
- if (assetDetail.latitude != null)
|
|
|
|
- Padding(
|
|
|
|
- padding: const EdgeInsets.only(top: 32.0),
|
|
|
|
- child: Column(
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
- children: [
|
|
|
|
- Divider(
|
|
|
|
- thickness: 1,
|
|
|
|
- color: Colors.grey[600],
|
|
|
|
- ),
|
|
|
|
- Text(
|
|
|
|
- "exif_bottom_sheet_location",
|
|
|
|
- style: TextStyle(fontSize: 11, color: Colors.grey[400]),
|
|
|
|
- ).tr(),
|
|
|
|
- if (assetDetail.latitude != null &&
|
|
|
|
- assetDetail.longitude != null)
|
|
|
|
- buildMap(),
|
|
|
|
- if (exifInfo != null &&
|
|
|
|
- exifInfo.city != null &&
|
|
|
|
- exifInfo.state != null)
|
|
|
|
- buildLocationText(),
|
|
|
|
- Text(
|
|
|
|
- "${assetDetail.latitude?.toStringAsFixed(4)}, ${assetDetail.longitude?.toStringAsFixed(4)}",
|
|
|
|
- style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
|
|
|
- )
|
|
|
|
- ],
|
|
|
|
|
|
+ return SingleChildScrollView(
|
|
|
|
+ child: Card(
|
|
|
|
+ margin: const EdgeInsets.all(0),
|
|
|
|
+ child: Container(
|
|
|
|
+ margin: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
|
|
+ child: Column(
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ const SizedBox(height: 12),
|
|
|
|
+ const Align(
|
|
|
|
+ alignment: Alignment.center,
|
|
|
|
+ child: CustomDraggingHandle(),
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- // Detail
|
|
|
|
- if (exifInfo != null)
|
|
|
|
- Padding(
|
|
|
|
- padding: const EdgeInsets.only(top: 32.0),
|
|
|
|
- child: Column(
|
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
- children: [
|
|
|
|
- Divider(
|
|
|
|
- thickness: 1,
|
|
|
|
- color: Colors.grey[600],
|
|
|
|
|
|
+ const SizedBox(height: 12),
|
|
|
|
+ if (exifInfo?.dateTimeOriginal != null)
|
|
|
|
+ Text(
|
|
|
|
+ DateFormat('date_format'.tr()).format(
|
|
|
|
+ exifInfo!.dateTimeOriginal!.toLocal(),
|
|
),
|
|
),
|
|
- Padding(
|
|
|
|
- padding: const EdgeInsets.only(bottom: 8.0),
|
|
|
|
- child: Text(
|
|
|
|
- "exif_bottom_sheet_details",
|
|
|
|
- style: TextStyle(fontSize: 11, color: Colors.grey[400]),
|
|
|
|
- ).tr(),
|
|
|
|
|
|
+ style: const TextStyle(
|
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
|
+ fontSize: 14,
|
|
),
|
|
),
|
|
- ListTile(
|
|
|
|
- contentPadding: const EdgeInsets.all(0),
|
|
|
|
- dense: true,
|
|
|
|
- textColor: Colors.grey[300],
|
|
|
|
- iconColor: Colors.grey[300],
|
|
|
|
- leading: const Icon(Icons.image),
|
|
|
|
- title: Text(
|
|
|
|
- "${exifInfo.imageName!}${p.extension(assetDetail.remote!.originalPath)}",
|
|
|
|
- style: const TextStyle(fontWeight: FontWeight.bold),
|
|
|
|
- ),
|
|
|
|
- subtitle: exifInfo.exifImageHeight != null
|
|
|
|
- ? Text(
|
|
|
|
- "${exifInfo.exifImageHeight} x ${exifInfo.exifImageWidth} ${formatBytes(exifInfo.fileSizeInByte!)} ",
|
|
|
|
- )
|
|
|
|
- : null,
|
|
|
|
|
|
+ ),
|
|
|
|
+
|
|
|
|
+ // Location
|
|
|
|
+ if (assetDetail.latitude != null)
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.only(top: 32.0),
|
|
|
|
+ child: Column(
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ const Divider(
|
|
|
|
+ thickness: 1,
|
|
|
|
+ ),
|
|
|
|
+ Text(
|
|
|
|
+ "exif_bottom_sheet_location",
|
|
|
|
+ style: TextStyle(fontSize: 11, color: textColor),
|
|
|
|
+ ).tr(),
|
|
|
|
+ if (assetDetail.latitude != null &&
|
|
|
|
+ assetDetail.longitude != null)
|
|
|
|
+ buildMap(),
|
|
|
|
+ if (exifInfo != null &&
|
|
|
|
+ exifInfo.city != null &&
|
|
|
|
+ exifInfo.state != null)
|
|
|
|
+ buildLocationText(),
|
|
|
|
+ Text(
|
|
|
|
+ "${assetDetail.latitude?.toStringAsFixed(4)}, ${assetDetail.longitude?.toStringAsFixed(4)}",
|
|
|
|
+ style: const TextStyle(fontSize: 12),
|
|
|
|
+ )
|
|
|
|
+ ],
|
|
),
|
|
),
|
|
- if (exifInfo.make != null)
|
|
|
|
- ListTile(
|
|
|
|
- contentPadding: const EdgeInsets.all(0),
|
|
|
|
- dense: true,
|
|
|
|
- textColor: Colors.grey[300],
|
|
|
|
- iconColor: Colors.grey[300],
|
|
|
|
- leading: const Icon(Icons.camera),
|
|
|
|
- title: Text(
|
|
|
|
- "${exifInfo.make} ${exifInfo.model}",
|
|
|
|
- style: const TextStyle(fontWeight: FontWeight.bold),
|
|
|
|
|
|
+ ),
|
|
|
|
+ // Detail
|
|
|
|
+ if (exifInfo != null)
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.only(top: 32.0),
|
|
|
|
+ child: Column(
|
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
+ children: [
|
|
|
|
+ Divider(
|
|
|
|
+ thickness: 1,
|
|
|
|
+ color: Colors.grey[600],
|
|
),
|
|
),
|
|
- subtitle: Text(
|
|
|
|
- "ƒ/${exifInfo.fNumber} 1/${(1 / (exifInfo.exposureTime ?? 1)).toStringAsFixed(0)} ${exifInfo.focalLength} mm ISO${exifInfo.iso} ",
|
|
|
|
|
|
+ Padding(
|
|
|
|
+ padding: const EdgeInsets.only(bottom: 8.0),
|
|
|
|
+ child: Text(
|
|
|
|
+ "exif_bottom_sheet_details",
|
|
|
|
+ style: TextStyle(fontSize: 11, color: textColor),
|
|
|
|
+ ).tr(),
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- ],
|
|
|
|
|
|
+ ListTile(
|
|
|
|
+ contentPadding: const EdgeInsets.all(0),
|
|
|
|
+ dense: true,
|
|
|
|
+ leading: const Icon(Icons.image),
|
|
|
|
+ title: Text(
|
|
|
|
+ "${exifInfo.imageName!}${p.extension(assetDetail.remote!.originalPath)}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
|
+ color: textColor,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ subtitle: exifInfo.exifImageHeight != null
|
|
|
|
+ ? Text(
|
|
|
|
+ "${exifInfo.exifImageHeight} x ${exifInfo.exifImageWidth} ${formatBytes(exifInfo.fileSizeInByte ?? 0)} ",
|
|
|
|
+ )
|
|
|
|
+ : null,
|
|
|
|
+ ),
|
|
|
|
+ if (exifInfo.make != null)
|
|
|
|
+ ListTile(
|
|
|
|
+ contentPadding: const EdgeInsets.all(0),
|
|
|
|
+ dense: true,
|
|
|
|
+ leading: const Icon(Icons.camera),
|
|
|
|
+ title: Text(
|
|
|
|
+ "${exifInfo.make} ${exifInfo.model}",
|
|
|
|
+ style: TextStyle(
|
|
|
|
+ color: textColor,
|
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ subtitle: Text(
|
|
|
|
+ "ƒ/${exifInfo.fNumber} 1/${(1 / (exifInfo.exposureTime ?? 1)).toStringAsFixed(0)} ${exifInfo.focalLength} mm ISO${exifInfo.iso} ",
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
|
|
+ const SizedBox(
|
|
|
|
+ height: 50,
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- ],
|
|
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
);
|
|
);
|
|
}
|
|
}
|