Compare commits
2 commits
main
...
placeholde
Author | SHA1 | Date | |
---|---|---|---|
![]() |
acf7b3a865 | ||
![]() |
8f1119525b |
22 changed files with 1053 additions and 178 deletions
|
@ -30,7 +30,7 @@
|
|||
"compare-versions": "^6.1",
|
||||
"electron-log": "^5.1",
|
||||
"electron-store": "^8.2",
|
||||
"electron-updater": "^6.2",
|
||||
"electron-updater": "^6.1",
|
||||
"ffmpeg-static": "^5.2",
|
||||
"html-entities": "^2.5",
|
||||
"jpeg-js": "^0.4",
|
||||
|
|
|
@ -743,10 +743,10 @@ buffer@^5.1.0, buffer@^5.5.0:
|
|||
base64-js "^1.3.1"
|
||||
ieee754 "^1.1.13"
|
||||
|
||||
builder-util-runtime@9.2.4:
|
||||
version "9.2.4"
|
||||
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-9.2.4.tgz#13cd1763da621e53458739a1e63f7fcba673c42a"
|
||||
integrity sha512-upp+biKpN/XZMLim7aguUyW8s0FUpDvOtK6sbanMFDAMBzpHDqdhgVYm6zc9HJ6nWo7u2Lxk60i2M6Jd3aiNrA==
|
||||
builder-util-runtime@9.2.3:
|
||||
version "9.2.3"
|
||||
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-9.2.3.tgz#0a82c7aca8eadef46d67b353c638f052c206b83c"
|
||||
integrity sha512-FGhkqXdFFZ5dNC4C+yuQB9ak311rpGAw+/ASz8ZdxwODCv1GGMWgLDeofRkdi0F3VCHQEWy/aXcJQozx2nOPiw==
|
||||
dependencies:
|
||||
debug "^4.3.4"
|
||||
sax "^1.2.4"
|
||||
|
@ -1251,12 +1251,12 @@ electron-store@^8.2:
|
|||
conf "^10.2.0"
|
||||
type-fest "^2.17.0"
|
||||
|
||||
electron-updater@^6.2:
|
||||
version "6.2.1"
|
||||
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-6.2.1.tgz#1c9adb9ba2a21a5dc50a8c434c45360d5e9fe6c9"
|
||||
integrity sha512-83eKIPW14qwZqUUM6wdsIRwVKZyjmHxQ4/8G+1C6iS5PdDt7b1umYQyj1/qPpH510GmHEQe4q0kCPe3qmb3a0Q==
|
||||
electron-updater@^6.1:
|
||||
version "6.1.8"
|
||||
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-6.1.8.tgz#17637bca165322f4e526b13c99165f43e6f697d8"
|
||||
integrity sha512-hhOTfaFAd6wRHAfUaBhnAOYc+ymSGCWJLtFkw4xJqOvtpHmIdNHnXDV9m1MHC+A6q08Abx4Ykgyz/R5DGKNAMQ==
|
||||
dependencies:
|
||||
builder-util-runtime "9.2.4"
|
||||
builder-util-runtime "9.2.3"
|
||||
fs-extra "^10.1.0"
|
||||
js-yaml "^4.1.0"
|
||||
lazy-val "^1.0.5"
|
||||
|
|
|
@ -35,15 +35,6 @@ class FaceMLDataDB {
|
|||
|
||||
static final FaceMLDataDB instance = FaceMLDataDB._privateConstructor();
|
||||
|
||||
static final _migrationScripts = [
|
||||
createFacesTable,
|
||||
createFaceClustersTable,
|
||||
createClusterPersonTable,
|
||||
createClusterSummaryTable,
|
||||
createNotPersonFeedbackTable,
|
||||
fcClusterIDIndex,
|
||||
];
|
||||
|
||||
// only have a single app-wide reference to the database
|
||||
static Future<SqliteDatabase>? _sqliteAsyncDBFuture;
|
||||
|
||||
|
@ -59,42 +50,17 @@ class FaceMLDataDB {
|
|||
_logger.info("Opening sqlite_async access: DB path " + databaseDirectory);
|
||||
final asyncDBConnection =
|
||||
SqliteDatabase(path: databaseDirectory, maxReaders: 2);
|
||||
final stopwatch = Stopwatch()..start();
|
||||
_logger.info("FaceMLDataDB: Starting migration");
|
||||
await _migrate(asyncDBConnection);
|
||||
_logger.info(
|
||||
"FaceMLDataDB Migration took ${stopwatch.elapsedMilliseconds} ms",
|
||||
);
|
||||
stopwatch.stop();
|
||||
|
||||
await _onCreate(asyncDBConnection);
|
||||
return asyncDBConnection;
|
||||
}
|
||||
|
||||
Future<void> _migrate(
|
||||
SqliteDatabase database,
|
||||
) async {
|
||||
final result = await database.execute('PRAGMA user_version');
|
||||
final currentVersion = result[0]['user_version'] as int;
|
||||
final toVersion = _migrationScripts.length;
|
||||
|
||||
if (currentVersion < toVersion) {
|
||||
_logger.info("Migrating database from $currentVersion to $toVersion");
|
||||
await database.writeTransaction((tx) async {
|
||||
for (int i = currentVersion + 1; i <= toVersion; i++) {
|
||||
try {
|
||||
await tx.execute(_migrationScripts[i - 1]);
|
||||
} catch (e) {
|
||||
_logger.severe("Error running migration script index ${i - 1}", e);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
await tx.execute('PRAGMA user_version = $toVersion');
|
||||
});
|
||||
} else if (currentVersion > toVersion) {
|
||||
throw AssertionError(
|
||||
"currentVersion($currentVersion) cannot be greater than toVersion($toVersion)",
|
||||
);
|
||||
}
|
||||
Future<void> _onCreate(SqliteDatabase asyncDBConnection) async {
|
||||
await asyncDBConnection.execute(createFacesTable);
|
||||
await asyncDBConnection.execute(createFaceClustersTable);
|
||||
await asyncDBConnection.execute(createClusterPersonTable);
|
||||
await asyncDBConnection.execute(createClusterSummaryTable);
|
||||
await asyncDBConnection.execute(createNotPersonFeedbackTable);
|
||||
await asyncDBConnection.execute(fcClusterIDIndex);
|
||||
}
|
||||
|
||||
// bulkInsertFaces inserts the faces in the database in batches of 1000.
|
||||
|
@ -229,10 +195,10 @@ class FaceMLDataDB {
|
|||
final db = await instance.asyncDB;
|
||||
|
||||
await db.execute(deleteFacesTable);
|
||||
await db.execute(deleteFaceClustersTable);
|
||||
await db.execute(deleteClusterPersonTable);
|
||||
await db.execute(deleteClusterSummaryTable);
|
||||
await db.execute(deleteNotPersonFeedbackTable);
|
||||
await db.execute(dropClusterPersonTable);
|
||||
await db.execute(dropClusterSummaryTable);
|
||||
await db.execute(deletePersonTable);
|
||||
await db.execute(dropNotPersonFeedbackTable);
|
||||
}
|
||||
|
||||
Future<Iterable<Uint8List>> getFaceEmbeddingsForCluster(
|
||||
|
@ -768,7 +734,7 @@ class FaceMLDataDB {
|
|||
try {
|
||||
final db = await instance.asyncDB;
|
||||
|
||||
await db.execute(deleteFaceClustersTable);
|
||||
await db.execute(dropFaceClustersTable);
|
||||
await db.execute(createFaceClustersTable);
|
||||
await db.execute(fcClusterIDIndex);
|
||||
} catch (e, s) {
|
||||
|
@ -979,15 +945,16 @@ class FaceMLDataDB {
|
|||
if (faces) {
|
||||
await db.execute(deleteFacesTable);
|
||||
await db.execute(createFacesTable);
|
||||
await db.execute(deleteFaceClustersTable);
|
||||
await db.execute(dropFaceClustersTable);
|
||||
await db.execute(createFaceClustersTable);
|
||||
await db.execute(fcClusterIDIndex);
|
||||
}
|
||||
|
||||
await db.execute(deleteClusterPersonTable);
|
||||
await db.execute(deleteNotPersonFeedbackTable);
|
||||
await db.execute(deleteClusterSummaryTable);
|
||||
await db.execute(deleteFaceClustersTable);
|
||||
await db.execute(deletePersonTable);
|
||||
await db.execute(dropClusterPersonTable);
|
||||
await db.execute(dropNotPersonFeedbackTable);
|
||||
await db.execute(dropClusterSummaryTable);
|
||||
await db.execute(dropFaceClustersTable);
|
||||
|
||||
await db.execute(createClusterPersonTable);
|
||||
await db.execute(createNotPersonFeedbackTable);
|
||||
|
@ -1005,8 +972,9 @@ class FaceMLDataDB {
|
|||
final db = await instance.asyncDB;
|
||||
|
||||
// Drop the tables
|
||||
await db.execute(deleteClusterPersonTable);
|
||||
await db.execute(deleteNotPersonFeedbackTable);
|
||||
await db.execute(deletePersonTable);
|
||||
await db.execute(dropClusterPersonTable);
|
||||
await db.execute(dropNotPersonFeedbackTable);
|
||||
|
||||
// Recreate the tables
|
||||
await db.execute(createClusterPersonTable);
|
||||
|
|
|
@ -29,7 +29,7 @@ const createFacesTable = '''CREATE TABLE IF NOT EXISTS $facesTable (
|
|||
);
|
||||
''';
|
||||
|
||||
const deleteFacesTable = 'DELETE FROM $facesTable';
|
||||
const deleteFacesTable = 'DROP TABLE IF EXISTS $facesTable';
|
||||
// End of Faces Table Fields & Schema Queries
|
||||
|
||||
//##region Face Clusters Table Fields & Schema Queries
|
||||
|
@ -48,9 +48,15 @@ CREATE TABLE IF NOT EXISTS $faceClustersTable (
|
|||
// -- Creating a non-unique index on clusterID for query optimization
|
||||
const fcClusterIDIndex =
|
||||
'''CREATE INDEX IF NOT EXISTS idx_fcClusterID ON $faceClustersTable($fcClusterID);''';
|
||||
const deleteFaceClustersTable = 'DELETE FROM $faceClustersTable';
|
||||
const dropFaceClustersTable = 'DROP TABLE IF EXISTS $faceClustersTable';
|
||||
//##endregion
|
||||
|
||||
// People Table Fields & Schema Queries
|
||||
const personTable = 'person';
|
||||
|
||||
const deletePersonTable = 'DROP TABLE IF EXISTS $personTable';
|
||||
//End People Table Fields & Schema Queries
|
||||
|
||||
// Clusters Table Fields & Schema Queries
|
||||
const clusterPersonTable = 'cluster_person';
|
||||
const personIdColumn = 'person_id';
|
||||
|
@ -63,7 +69,7 @@ CREATE TABLE IF NOT EXISTS $clusterPersonTable (
|
|||
PRIMARY KEY($personIdColumn, $clusterIDColumn)
|
||||
);
|
||||
''';
|
||||
const deleteClusterPersonTable = 'DELETE FROM $clusterPersonTable';
|
||||
const dropClusterPersonTable = 'DROP TABLE IF EXISTS $clusterPersonTable';
|
||||
// End Clusters Table Fields & Schema Queries
|
||||
|
||||
/// Cluster Summary Table Fields & Schema Queries
|
||||
|
@ -79,7 +85,7 @@ CREATE TABLE IF NOT EXISTS $clusterSummaryTable (
|
|||
);
|
||||
''';
|
||||
|
||||
const deleteClusterSummaryTable = 'DELETE FROM $clusterSummaryTable';
|
||||
const dropClusterSummaryTable = 'DROP TABLE IF EXISTS $clusterSummaryTable';
|
||||
|
||||
/// End Cluster Summary Table Fields & Schema Queries
|
||||
|
||||
|
@ -93,5 +99,5 @@ CREATE TABLE IF NOT EXISTS $notPersonFeedback (
|
|||
PRIMARY KEY($personIdColumn, $clusterIDColumn)
|
||||
);
|
||||
''';
|
||||
const deleteNotPersonFeedbackTable = 'DELETE FROM $notPersonFeedback';
|
||||
const dropNotPersonFeedbackTable = 'DROP TABLE IF EXISTS $notPersonFeedback';
|
||||
// End Clusters Table Fields & Schema Queries
|
||||
|
|
2
mobile/lib/generated/intl/messages_en.dart
generated
2
mobile/lib/generated/intl/messages_en.dart
generated
|
@ -814,7 +814,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Incorrect recovery key"),
|
||||
"indexedItems": MessageLookupByLibrary.simpleMessage("Indexed items"),
|
||||
"indexingIsPaused": MessageLookupByLibrary.simpleMessage(
|
||||
"Indexing is paused. It will automatically resume when device is ready."),
|
||||
"Indexing is paused, will automatically resume when device is ready"),
|
||||
"insecureDevice":
|
||||
MessageLookupByLibrary.simpleMessage("Insecure device"),
|
||||
"installManually":
|
||||
|
|
4
mobile/lib/generated/l10n.dart
generated
4
mobile/lib/generated/l10n.dart
generated
|
@ -8794,10 +8794,10 @@ class S {
|
|||
);
|
||||
}
|
||||
|
||||
/// `Indexing is paused. It will automatically resume when device is ready.`
|
||||
/// `Indexing is paused, will automatically resume when device is ready`
|
||||
String get indexingIsPaused {
|
||||
return Intl.message(
|
||||
'Indexing is paused. It will automatically resume when device is ready.',
|
||||
'Indexing is paused, will automatically resume when device is ready',
|
||||
name: 'indexingIsPaused',
|
||||
desc: '',
|
||||
args: [],
|
||||
|
|
|
@ -1236,5 +1236,5 @@
|
|||
"faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.",
|
||||
"foundFaces": "Found faces",
|
||||
"clusteringProgress": "Clustering progress",
|
||||
"indexingIsPaused": "Indexing is paused. It will automatically resume when device is ready."
|
||||
}
|
||||
"indexingIsPaused": "Indexing is paused, will automatically resume when device is ready"
|
||||
}
|
|
@ -246,11 +246,17 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
|
|||
|
||||
unawaited(SemanticSearchService.instance.init());
|
||||
MachineLearningController.instance.init();
|
||||
if (flagService.faceSearchEnabled) {
|
||||
unawaited(FaceMlService.instance.init());
|
||||
} else {
|
||||
if (LocalSettings.instance.isFaceIndexingEnabled) {
|
||||
unawaited(LocalSettings.instance.toggleFaceIndexing());
|
||||
// Can not including existing tf/ml binaries as they are not being built
|
||||
// from source.
|
||||
// See https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12671#note_1294346819
|
||||
if (!UpdateService.instance.isFdroidFlavor()) {
|
||||
// unawaited(ObjectDetectionService.instance.init());
|
||||
if (flagService.faceSearchEnabled) {
|
||||
unawaited(FaceMlService.instance.init());
|
||||
} else {
|
||||
if (LocalSettings.instance.isFaceIndexingEnabled) {
|
||||
unawaited(LocalSettings.instance.toggleFaceIndexing());
|
||||
}
|
||||
}
|
||||
}
|
||||
PersonService.init(
|
||||
|
|
|
@ -43,7 +43,6 @@ import 'package:photos/services/machine_learning/face_ml/face_ml_result.dart';
|
|||
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
|
||||
import 'package:photos/services/machine_learning/file_ml/file_ml.dart';
|
||||
import 'package:photos/services/machine_learning/file_ml/remote_fileml_service.dart';
|
||||
import "package:photos/services/machine_learning/machine_learning_controller.dart";
|
||||
import "package:photos/services/search_service.dart";
|
||||
import "package:photos/utils/file_util.dart";
|
||||
import 'package:photos/utils/image_ml_isolate.dart';
|
||||
|
@ -100,7 +99,7 @@ class FaceMlService {
|
|||
|
||||
final int _fileDownloadLimit = 5;
|
||||
final int _embeddingFetchLimit = 200;
|
||||
final int _kForceClusteringFaceCount = 8000;
|
||||
final int _kForceClusteringFaceCount = 4000;
|
||||
|
||||
Future<void> init({bool initializeImageMlIsolate = false}) async {
|
||||
if (LocalSettings.instance.isFaceIndexingEnabled == false) {
|
||||
|
@ -164,16 +163,9 @@ class FaceMlService {
|
|||
pauseIndexingAndClustering();
|
||||
}
|
||||
});
|
||||
if (Platform.isIOS &&
|
||||
MachineLearningController.instance.isDeviceHealthy) {
|
||||
_logger.info("Starting face indexing and clustering on iOS from init");
|
||||
unawaited(indexAndClusterAll());
|
||||
}
|
||||
|
||||
_listenIndexOnDiffSync();
|
||||
_listenOnPeopleChangedSync();
|
||||
|
||||
_logger.info('init done');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1024,13 +1016,9 @@ class FaceMlService {
|
|||
File? file;
|
||||
if (enteFile.fileType == FileType.video) {
|
||||
try {
|
||||
file = await getThumbnailForUploadedFile(enteFile);
|
||||
file = await getThumbnailForUploadedFile(enteFile);
|
||||
} on PlatformException catch (e, s) {
|
||||
_logger.severe(
|
||||
"Could not get thumbnail for $enteFile due to PlatformException",
|
||||
e,
|
||||
s,
|
||||
);
|
||||
_logger.severe("Could not get thumbnail for $enteFile due to PlatformException", e, s);
|
||||
throw ThumbnailRetrievalException(e.toString(), s);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -4,6 +4,7 @@ import "dart:io";
|
|||
import "package:battery_info/battery_info_plugin.dart";
|
||||
import "package:battery_info/model/android_battery_info.dart";
|
||||
import "package:battery_info/model/iso_battery_info.dart";
|
||||
import "package:flutter/foundation.dart" show kDebugMode;
|
||||
import "package:logging/logging.dart";
|
||||
import "package:photos/core/event_bus.dart";
|
||||
import "package:photos/events/machine_learning_control_event.dart";
|
||||
|
@ -18,7 +19,8 @@ class MachineLearningController {
|
|||
|
||||
static const kMaximumTemperature = 42; // 42 degree celsius
|
||||
static const kMinimumBatteryLevel = 20; // 20%
|
||||
static const kDefaultInteractionTimeout = Duration(seconds: 10);
|
||||
static const kDefaultInteractionTimeout =
|
||||
kDebugMode ? Duration(seconds: 3) : Duration(seconds: 5);
|
||||
static const kUnhealthyStates = ["over_heat", "over_voltage", "dead"];
|
||||
|
||||
bool _isDeviceHealthy = true;
|
||||
|
@ -29,7 +31,6 @@ class MachineLearningController {
|
|||
bool get isDeviceHealthy => _isDeviceHealthy;
|
||||
|
||||
void init() {
|
||||
_logger.info('init called');
|
||||
if (Platform.isAndroid) {
|
||||
_startInteractionTimer();
|
||||
BatteryInfoPlugin()
|
||||
|
@ -46,7 +47,6 @@ class MachineLearningController {
|
|||
});
|
||||
}
|
||||
_fireControlEvent();
|
||||
_logger.info('init done');
|
||||
}
|
||||
|
||||
void onUserInteraction() {
|
||||
|
|
65
mobile/lib/ui/TEMP/captureImage.dart
Normal file
65
mobile/lib/ui/TEMP/captureImage.dart
Normal file
|
@ -0,0 +1,65 @@
|
|||
// import "dart:typed_data";
|
||||
// import 'dart:ui' as ui;
|
||||
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter/rendering.dart';
|
||||
|
||||
// class Captures {
|
||||
// static Future<Uint8List> capture(GlobalKey key) async {
|
||||
// final double pixelRatio =
|
||||
// MediaQuery.of(key.currentContext!).devicePixelRatio;
|
||||
// final RenderRepaintBoundary boundary =
|
||||
// key.currentContext!.findRenderObject()! as RenderRepaintBoundary;
|
||||
// final ui.Image image = await boundary.toImage(pixelRatio: pixelRatio);
|
||||
// final ByteData? byteData =
|
||||
// await image.toByteData(format: ui.ImageByteFormat.png);
|
||||
// final Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||
// print("PNG BYTES ====== ${pngBytes}");
|
||||
// return pngBytes;
|
||||
// }
|
||||
// }
|
||||
import "dart:io";
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import "package:path_provider/path_provider.dart";
|
||||
|
||||
class Captures {
|
||||
Future<Uint8List?> capture(GlobalKey key) async {
|
||||
try {
|
||||
final double pixelRatio =
|
||||
MediaQuery.of(key.currentContext!).devicePixelRatio;
|
||||
final RenderRepaintBoundary boundary =
|
||||
key.currentContext!.findRenderObject()! as RenderRepaintBoundary;
|
||||
final ui.Image image = await boundary.toImage(pixelRatio: pixelRatio);
|
||||
final ByteData? byteData =
|
||||
await image.toByteData(format: ui.ImageByteFormat.png);
|
||||
final Uint8List pngBytes = byteData!.buffer.asUint8List();
|
||||
print("PNG BYTES ====== ${pngBytes}");
|
||||
|
||||
return pngBytes;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<String> saveImage(GlobalKey key) async {
|
||||
String path = "";
|
||||
try {
|
||||
final Uint8List? bytes = await capture(key);
|
||||
final Directory root = await getTemporaryDirectory();
|
||||
final String directoryPath = '${root.path}/enteTempFiles';
|
||||
// Create the directory if it doesn't exist
|
||||
final DateTime timeStamp = DateTime.now();
|
||||
await Directory(directoryPath).create(recursive: true);
|
||||
final String filePath = '$directoryPath/$timeStamp.jpg';
|
||||
final file = await File(filePath).writeAsBytes(bytes!);
|
||||
path = file.path;
|
||||
} catch (e) {
|
||||
debugPrint(e.toString());
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
790
mobile/lib/ui/TEMP/show_images_prevew.dart
Normal file
790
mobile/lib/ui/TEMP/show_images_prevew.dart
Normal file
|
@ -0,0 +1,790 @@
|
|||
import "dart:ui";
|
||||
|
||||
import "package:figma_squircle/figma_squircle.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:photos/models/file/file.dart";
|
||||
import "package:photos/ui/TEMP/captureImage.dart";
|
||||
import "package:photos/ui/TEMP/widget_to_image.dart";
|
||||
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
|
||||
|
||||
class ShowImagePreviewFromTap extends StatefulWidget {
|
||||
const ShowImagePreviewFromTap({
|
||||
required this.tempEnteFile,
|
||||
super.key,
|
||||
});
|
||||
final List<EnteFile> tempEnteFile;
|
||||
@override
|
||||
State<ShowImagePreviewFromTap> createState() =>
|
||||
_ShowImagePreviewFromTapState();
|
||||
}
|
||||
|
||||
class _ShowImagePreviewFromTapState extends State<ShowImagePreviewFromTap> {
|
||||
// late String tempImagePath;
|
||||
// final ValueNotifier<Uint8List?> bytesNotifier =
|
||||
// ValueNotifier<Uint8List?>(null);
|
||||
|
||||
late GlobalKey _widgetImageKey;
|
||||
final ValueNotifier<String?> tempImagePath = ValueNotifier<String?>(null);
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
//delay of 1 second before capturing the image
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
|
||||
tempImagePath.value = await Captures().saveImage(_widgetImageKey);
|
||||
|
||||
Navigator.of(context).pop(tempImagePath.value);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final int length = widget.tempEnteFile.length;
|
||||
Widget placeholderWidget = const SizedBox(
|
||||
height: 250,
|
||||
width: 250,
|
||||
);
|
||||
|
||||
if (length == 1) {
|
||||
placeholderWidget = BackDrop(
|
||||
backDropImage: widget.tempEnteFile[0],
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: ClipSmoothRect(
|
||||
radius: SmoothBorderRadius(
|
||||
cornerRadius: 7.5,
|
||||
cornerSmoothing: 1,
|
||||
),
|
||||
child: ThumbnailWidget(
|
||||
widget.tempEnteFile[0],
|
||||
shouldShowArchiveStatus: false,
|
||||
shouldShowSyncStatus: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else if (length == 2) {
|
||||
placeholderWidget = BackDrop(
|
||||
backDropImage: widget.tempEnteFile[0],
|
||||
children: [
|
||||
Positioned(
|
||||
top: 65,
|
||||
left: 90,
|
||||
child: CustomImage(
|
||||
height: 100,
|
||||
width: 100,
|
||||
collages: widget.tempEnteFile[0],
|
||||
zIndex: 0.2,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 20,
|
||||
left: 0,
|
||||
child: CustomImage(
|
||||
height: 100,
|
||||
width: 100,
|
||||
collages: widget.tempEnteFile[1],
|
||||
zIndex: -0.2,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else if (length == 3) {
|
||||
placeholderWidget = BackDrop(
|
||||
backDropImage: widget.tempEnteFile[0],
|
||||
children: [
|
||||
Positioned(
|
||||
top: 30,
|
||||
left: 0,
|
||||
child: CustomImage(
|
||||
height: 80,
|
||||
width: 80,
|
||||
collages: widget.tempEnteFile[1],
|
||||
zIndex: -0.4,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 80,
|
||||
left: 110,
|
||||
child: CustomImage(
|
||||
height: 80,
|
||||
width: 80,
|
||||
collages: widget.tempEnteFile[2],
|
||||
zIndex: 0.4,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 40,
|
||||
left: 40,
|
||||
child: CustomImage(
|
||||
height: 100,
|
||||
width: 100,
|
||||
collages: widget.tempEnteFile[0],
|
||||
zIndex: 0.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
} else if (length > 3) {
|
||||
placeholderWidget = BackDrop(
|
||||
backDropImage: widget.tempEnteFile[0],
|
||||
children: [
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 10,
|
||||
child: CustomImage(
|
||||
height: 80,
|
||||
width: 80,
|
||||
collages: widget.tempEnteFile[1],
|
||||
zIndex: 0,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 95,
|
||||
left: 30,
|
||||
child: CustomImage(
|
||||
height: 80,
|
||||
width: 80,
|
||||
collages: widget.tempEnteFile[2],
|
||||
zIndex: 0,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 35,
|
||||
left: 60,
|
||||
child: CustomImage(
|
||||
height: 100,
|
||||
width: 100,
|
||||
collages: widget.tempEnteFile[0],
|
||||
zIndex: 0.0,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 15,
|
||||
left: 140,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
"+" "$length",
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Offstage(
|
||||
offstage: false,
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
WidgetToImage(
|
||||
builder: (key) {
|
||||
_widgetImageKey = key;
|
||||
return placeholderWidget;
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BackDrop extends StatelessWidget {
|
||||
const BackDrop({
|
||||
super.key,
|
||||
required this.backDropImage,
|
||||
required this.children,
|
||||
});
|
||||
final List<Widget> children;
|
||||
final EnteFile backDropImage;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
height: 200,
|
||||
width: 200,
|
||||
child: Stack(
|
||||
children: [
|
||||
ClipSmoothRect(
|
||||
radius: SmoothBorderRadius(
|
||||
cornerRadius: 7.5,
|
||||
cornerSmoothing: 1,
|
||||
),
|
||||
child: ThumbnailWidget(
|
||||
backDropImage,
|
||||
shouldShowArchiveStatus: false,
|
||||
shouldShowSyncStatus: false,
|
||||
),
|
||||
),
|
||||
BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CustomImage extends StatelessWidget {
|
||||
const CustomImage({
|
||||
required this.width,
|
||||
required this.height,
|
||||
super.key,
|
||||
required this.collages,
|
||||
required this.zIndex,
|
||||
});
|
||||
final EnteFile collages;
|
||||
final double zIndex;
|
||||
final double height;
|
||||
final double width;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
transform: Matrix4.rotationZ(zIndex),
|
||||
height: height,
|
||||
width: width,
|
||||
child: ClipSmoothRect(
|
||||
radius: SmoothBorderRadius(
|
||||
cornerRadius: 7.5,
|
||||
cornerSmoothing: 1,
|
||||
),
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
child: ThumbnailWidget(
|
||||
collages,
|
||||
shouldShowArchiveStatus: false,
|
||||
shouldShowSyncStatus: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// import "dart:ui";
|
||||
|
||||
// import "package:figma_squircle/figma_squircle.dart";
|
||||
// import "package:flutter/material.dart";
|
||||
// import "package:photos/models/file/file.dart";
|
||||
// import "package:photos/ui/TEMP/captureImage.dart";
|
||||
// import "package:photos/ui/TEMP/widget_to_image.dart";
|
||||
// import "package:photos/ui/viewer/file/thumbnail_widget.dart";
|
||||
|
||||
// class ShowImagePrev {
|
||||
// late GlobalKey _widgetImageKey;
|
||||
// final ValueNotifier<String?> tempImagePath = ValueNotifier<String?>(null);
|
||||
// Future<String?> imageToWidgetFunction(List<EnteFile> tempEnteFile) async {
|
||||
// showImagePreviewFromTap(tempEnteFile);
|
||||
// await Future.delayed(const Duration(milliseconds: 100));
|
||||
// tempImagePath.value = await Captures().saveImage(_widgetImageKey);
|
||||
|
||||
// print("VALUE IS ==================${tempImagePath.value}");
|
||||
// if (tempImagePath.value != null) {
|
||||
// return tempImagePath.value;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// Widget showImagePreviewFromTap(List<EnteFile> tempEnteFile) {
|
||||
// final int length = tempEnteFile.length;
|
||||
// Widget placeholderWidget = const SizedBox(
|
||||
// height: 250,
|
||||
// width: 250,
|
||||
// );
|
||||
|
||||
// if (length == 1) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(18.0),
|
||||
// child: ClipSmoothRect(
|
||||
// radius: SmoothBorderRadius(
|
||||
// cornerRadius: 7.5,
|
||||
// cornerSmoothing: 1,
|
||||
// ),
|
||||
// child: ThumbnailWidget(
|
||||
// tempEnteFile[0],
|
||||
// shouldShowArchiveStatus: false,
|
||||
// shouldShowSyncStatus: false,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else if (length == 2) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Positioned(
|
||||
// top: 65,
|
||||
// left: 90,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[0],
|
||||
// zIndex: 0.2,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 20,
|
||||
// left: 0,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[1],
|
||||
// zIndex: -0.2,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else if (length == 3) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Positioned(
|
||||
// top: 30,
|
||||
// left: 0,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[1],
|
||||
// zIndex: -0.4,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 80,
|
||||
// left: 110,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[2],
|
||||
// zIndex: 0.4,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 40,
|
||||
// left: 40,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[0],
|
||||
// zIndex: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else if (length > 3) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Positioned(
|
||||
// top: 10,
|
||||
// left: 10,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[1],
|
||||
// zIndex: 0,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 95,
|
||||
// left: 30,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[2],
|
||||
// zIndex: 0,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 35,
|
||||
// left: 60,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[0],
|
||||
// zIndex: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 15,
|
||||
// left: 140,
|
||||
// child: Container(
|
||||
// padding: const EdgeInsets.all(8),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(12),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "+ $length",
|
||||
// style: const TextStyle(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
// return Center(
|
||||
// child: WidgetToImage(
|
||||
// builder: (key) {
|
||||
// _widgetImageKey = key;
|
||||
// return placeholderWidget;
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// class BackDrop extends StatelessWidget {
|
||||
// const BackDrop({
|
||||
// super.key,
|
||||
// required this.backDropImage,
|
||||
// required this.children,
|
||||
// });
|
||||
// final List<Widget> children;
|
||||
// final EnteFile backDropImage;
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Container(
|
||||
// padding: const EdgeInsets.all(4.0),
|
||||
// height: 200,
|
||||
// width: 200,
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// ClipSmoothRect(
|
||||
// radius: SmoothBorderRadius(
|
||||
// cornerRadius: 7.5,
|
||||
// cornerSmoothing: 1,
|
||||
// ),
|
||||
// child: ThumbnailWidget(
|
||||
// backDropImage,
|
||||
// shouldShowArchiveStatus: false,
|
||||
// shouldShowSyncStatus: false,
|
||||
// ),
|
||||
// ),
|
||||
// BackdropFilter(
|
||||
// filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||
// child: Container(
|
||||
// color: Colors.transparent,
|
||||
// ),
|
||||
// ),
|
||||
// ...children,
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// class CustomImage extends StatelessWidget {
|
||||
// const CustomImage({
|
||||
// required this.width,
|
||||
// required this.height,
|
||||
// super.key,
|
||||
// required this.collages,
|
||||
// required this.zIndex,
|
||||
// });
|
||||
// final EnteFile collages;
|
||||
// final double zIndex;
|
||||
// final double height;
|
||||
// final double width;
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Container(
|
||||
// transform: Matrix4.rotationZ(zIndex),
|
||||
// height: height,
|
||||
// width: width,
|
||||
// child: ClipSmoothRect(
|
||||
// radius: SmoothBorderRadius(
|
||||
// cornerRadius: 7.5,
|
||||
// cornerSmoothing: 1,
|
||||
// ),
|
||||
// clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
// child: ThumbnailWidget(
|
||||
// collages,
|
||||
// shouldShowArchiveStatus: false,
|
||||
// shouldShowSyncStatus: false,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// import "dart:ui";
|
||||
|
||||
// import "package:figma_squircle/figma_squircle.dart";
|
||||
// import "package:flutter/material.dart";
|
||||
// import "package:photos/models/file/file.dart";
|
||||
// import "package:photos/ui/TEMP/captureImage.dart";
|
||||
// import "package:photos/ui/TEMP/widget_to_image.dart";
|
||||
// import "package:photos/ui/viewer/file/thumbnail_widget.dart";
|
||||
|
||||
// class ShowImagePrev {
|
||||
// late GlobalKey _widgetImageKey;
|
||||
// final ValueNotifier<String?> tempImagePath = ValueNotifier<String?>(null);
|
||||
|
||||
// ShowImagePrev() {
|
||||
// _widgetImageKey = GlobalKey();
|
||||
// }
|
||||
|
||||
// Future<String?> imageToWidgetFunction(List<EnteFile> tempEnteFile) async {
|
||||
// showImagePreviewFromTap(tempEnteFile);
|
||||
// // Build the widget to ensure the GlobalKey is assigned correctly
|
||||
// WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// await Future.delayed(const Duration(milliseconds: 100));
|
||||
// tempImagePath.value = await Captures().saveImage(_widgetImageKey);
|
||||
// print("VALUE IS ==================${tempImagePath.value}");
|
||||
// });
|
||||
|
||||
// return tempImagePath.value;
|
||||
// }
|
||||
|
||||
// Widget showImagePreviewFromTap(List<EnteFile> tempEnteFile) {
|
||||
// final int length = tempEnteFile.length;
|
||||
// Widget placeholderWidget = const SizedBox(
|
||||
// height: 250,
|
||||
// width: 250,
|
||||
// );
|
||||
|
||||
// if (length == 1) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.all(18.0),
|
||||
// child: ClipSmoothRect(
|
||||
// radius: SmoothBorderRadius(
|
||||
// cornerRadius: 7.5,
|
||||
// cornerSmoothing: 1,
|
||||
// ),
|
||||
// child: ThumbnailWidget(
|
||||
// tempEnteFile[0],
|
||||
// shouldShowArchiveStatus: false,
|
||||
// shouldShowSyncStatus: false,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else if (length == 2) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Positioned(
|
||||
// top: 65,
|
||||
// left: 90,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[0],
|
||||
// zIndex: 0.2,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 20,
|
||||
// left: 0,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[1],
|
||||
// zIndex: -0.2,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else if (length == 3) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Positioned(
|
||||
// top: 30,
|
||||
// left: 0,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[1],
|
||||
// zIndex: -0.4,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 80,
|
||||
// left: 110,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[2],
|
||||
// zIndex: 0.4,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 40,
|
||||
// left: 40,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[0],
|
||||
// zIndex: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// } else if (length > 3) {
|
||||
// placeholderWidget = BackDrop(
|
||||
// backDropImage: tempEnteFile[0],
|
||||
// children: [
|
||||
// Positioned(
|
||||
// top: 10,
|
||||
// left: 10,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[1],
|
||||
// zIndex: 0,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 95,
|
||||
// left: 30,
|
||||
// child: CustomImage(
|
||||
// height: 80,
|
||||
// width: 80,
|
||||
// collages: tempEnteFile[2],
|
||||
// zIndex: 0,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 35,
|
||||
// left: 60,
|
||||
// child: CustomImage(
|
||||
// height: 100,
|
||||
// width: 100,
|
||||
// collages: tempEnteFile[0],
|
||||
// zIndex: 0.0,
|
||||
// ),
|
||||
// ),
|
||||
// Positioned(
|
||||
// top: 15,
|
||||
// left: 140,
|
||||
// child: Container(
|
||||
// padding: const EdgeInsets.all(8),
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(12),
|
||||
// ),
|
||||
// child: Text(
|
||||
// "+ $length",
|
||||
// style: const TextStyle(
|
||||
// fontWeight: FontWeight.w600,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
// return Center(
|
||||
// child: WidgetToImage(
|
||||
// builder: (key) {
|
||||
// _widgetImageKey = key;
|
||||
// return placeholderWidget;
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// class BackDrop extends StatelessWidget {
|
||||
// const BackDrop({
|
||||
// super.key,
|
||||
// required this.backDropImage,
|
||||
// required this.children,
|
||||
// });
|
||||
// final List<Widget> children;
|
||||
// final EnteFile backDropImage;
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Container(
|
||||
// padding: const EdgeInsets.all(4.0),
|
||||
// height: 200,
|
||||
// width: 200,
|
||||
// child: Stack(
|
||||
// children: [
|
||||
// ClipSmoothRect(
|
||||
// radius: SmoothBorderRadius(
|
||||
// cornerRadius: 7.5,
|
||||
// cornerSmoothing: 1,
|
||||
// ),
|
||||
// child: ThumbnailWidget(
|
||||
// backDropImage,
|
||||
// shouldShowArchiveStatus: false,
|
||||
// shouldShowSyncStatus: false,
|
||||
// ),
|
||||
// ),
|
||||
// BackdropFilter(
|
||||
// filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||
// child: Container(
|
||||
// color: Colors.transparent,
|
||||
// ),
|
||||
// ),
|
||||
// ...children,
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// class CustomImage extends StatelessWidget {
|
||||
// const CustomImage({
|
||||
// required this.width,
|
||||
// required this.height,
|
||||
// super.key,
|
||||
// required this.collages,
|
||||
// required this.zIndex,
|
||||
// });
|
||||
// final EnteFile collages;
|
||||
// final double zIndex;
|
||||
// final double height;
|
||||
// final double width;
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Container(
|
||||
// transform: Matrix4.rotationZ(zIndex),
|
||||
// height: height,
|
||||
// width: width,
|
||||
// child: ClipSmoothRect(
|
||||
// radius: SmoothBorderRadius(
|
||||
// cornerRadius: 7.5,
|
||||
// cornerSmoothing: 1,
|
||||
// ),
|
||||
// clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
// child: ThumbnailWidget(
|
||||
// collages,
|
||||
// shouldShowArchiveStatus: false,
|
||||
// shouldShowSyncStatus: false,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
19
mobile/lib/ui/TEMP/widget_to_image.dart
Normal file
19
mobile/lib/ui/TEMP/widget_to_image.dart
Normal file
|
@ -0,0 +1,19 @@
|
|||
import "package:flutter/material.dart";
|
||||
|
||||
class WidgetToImage extends StatefulWidget {
|
||||
const WidgetToImage({super.key, required this.builder});
|
||||
final Function(GlobalKey key) builder;
|
||||
@override
|
||||
State<WidgetToImage> createState() => _WidgetToImageState();
|
||||
}
|
||||
|
||||
class _WidgetToImageState extends State<WidgetToImage> {
|
||||
final globalKey = GlobalKey();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RepaintBoundary(
|
||||
key: globalKey,
|
||||
child: widget.builder(globalKey),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -110,6 +110,7 @@ class CollectionActions {
|
|||
BuildContext context,
|
||||
List<EnteFile> files,
|
||||
) async {
|
||||
print("CREATED LINK");
|
||||
final dialog = createProgressDialog(
|
||||
context,
|
||||
S.of(context).creatingLink,
|
||||
|
|
|
@ -89,8 +89,8 @@ class _MachineLearningSettingsPageState
|
|||
iconButtonType: IconButtonType.secondary,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
if (Navigator.canPop(context)) Navigator.pop(context);
|
||||
if (Navigator.canPop(context)) Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
@ -25,6 +25,7 @@ import 'package:photos/services/machine_learning/face_ml/feedback/cluster_feedba
|
|||
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
|
||||
import "package:photos/theme/colors.dart";
|
||||
import "package:photos/theme/ente_theme.dart";
|
||||
import "package:photos/ui/TEMP/show_images_prevew.dart";
|
||||
import 'package:photos/ui/actions/collection/collection_file_actions.dart';
|
||||
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
|
||||
import 'package:photos/ui/collections/collection_action_sheet.dart';
|
||||
|
@ -602,6 +603,25 @@ class _FileSelectionActionsWidgetState
|
|||
}
|
||||
}
|
||||
|
||||
ValueNotifier<String?> generatedPathNotifier = ValueNotifier<String?>(null);
|
||||
//Future function to go to next page
|
||||
Future<String?> _nextPageForTesting(List<EnteFile> tempfile) async {
|
||||
final String? tempImagePath = await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ShowImagePreviewFromTap(
|
||||
tempEnteFile: tempfile,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (tempImagePath != null) {
|
||||
print("Temp image path: $tempImagePath");
|
||||
|
||||
return tempImagePath;
|
||||
}
|
||||
return tempImagePath;
|
||||
}
|
||||
|
||||
Future<void> _onCreatedSharedLinkClicked() async {
|
||||
if (split.ownedByCurrentUser.isEmpty) {
|
||||
showShortToast(
|
||||
|
@ -612,16 +632,26 @@ class _FileSelectionActionsWidgetState
|
|||
}
|
||||
_cachedCollectionForSharedLink ??= await collectionActions
|
||||
.createSharedCollectionLink(context, split.ownedByCurrentUser);
|
||||
|
||||
final List<EnteFile> tempEnteFile = split.ownedByCurrentUser;
|
||||
|
||||
final actionResult = await showActionSheet(
|
||||
context: context,
|
||||
buttons: [
|
||||
ButtonWidget(
|
||||
labelText: S.of(context).copyLink,
|
||||
labelText: S.of(context).shareLink,
|
||||
buttonType: ButtonType.neutral,
|
||||
buttonSize: ButtonSize.large,
|
||||
shouldStickToDarkTheme: true,
|
||||
buttonAction: ButtonAction.first,
|
||||
isInAlert: true,
|
||||
// onTap: () async {
|
||||
// // Add a return statement at the end of the function
|
||||
// generatedPathNotifier.value =
|
||||
// await _nextPageForTesting(tempEnteFile);
|
||||
// await shareText(generatedPathNotifier.value!);
|
||||
// return Future<void>.value();
|
||||
// },
|
||||
),
|
||||
ButtonWidget(
|
||||
labelText: S.of(context).manageLink,
|
||||
|
@ -646,6 +676,7 @@ class _FileSelectionActionsWidgetState
|
|||
);
|
||||
if (actionResult?.action != null) {
|
||||
if (actionResult!.action == ButtonAction.first) {
|
||||
//generatedPathNotifier.value = await _nextPageForTesting(tempEnteFile);
|
||||
await _copyLink();
|
||||
}
|
||||
if (actionResult.action == ButtonAction.second) {
|
||||
|
@ -757,6 +788,7 @@ class _FileSelectionActionsWidgetState
|
|||
}
|
||||
|
||||
Future<void> _copyLink() async {
|
||||
print("INSIDE COPY LINK");
|
||||
if (_cachedCollectionForSharedLink != null) {
|
||||
final String collectionKey = Base58Encode(
|
||||
CollectionsService.instance
|
||||
|
@ -764,6 +796,8 @@ class _FileSelectionActionsWidgetState
|
|||
);
|
||||
final String url =
|
||||
"${_cachedCollectionForSharedLink!.publicURLs?.first?.url}#$collectionKey";
|
||||
await shareText(url);
|
||||
//await shareImageAndUrl(context, generatedPathNotifier.value!, url);
|
||||
await Clipboard.setData(ClipboardData(text: url));
|
||||
showShortToast(context, S.of(context).linkCopiedToClipboard);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class _AppBarWidgetState extends State<ClusterAppBar> {
|
|||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
actions: _getDefaultActions(context),
|
||||
actions: kDebugMode ? _getDefaultActions(context) : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -161,45 +161,43 @@ class _ClusterPageState extends State<ClusterPage> {
|
|||
),
|
||||
),
|
||||
showNamingBanner
|
||||
? SafeArea(
|
||||
child: Dismissible(
|
||||
key: const Key("namingBanner"),
|
||||
direction: DismissDirection.horizontal,
|
||||
onDismissed: (direction) {
|
||||
setState(() {
|
||||
userDismissedNamingBanner = true;
|
||||
});
|
||||
},
|
||||
child: PeopleBanner(
|
||||
type: PeopleBannerType.addName,
|
||||
faceWidget: PersonFaceWidget(
|
||||
files.first,
|
||||
clusterID: widget.clusterID,
|
||||
),
|
||||
actionIcon: Icons.add_outlined,
|
||||
text: S.of(context).addAName,
|
||||
subText: S.of(context).findPeopleByName,
|
||||
onTap: () async {
|
||||
if (widget.personID == null) {
|
||||
final result = await showAssignPersonAction(
|
||||
context,
|
||||
clusterID: widget.clusterID,
|
||||
);
|
||||
if (result != null &&
|
||||
result is (PersonEntity, EnteFile)) {
|
||||
Navigator.pop(context);
|
||||
// ignore: unawaited_futures
|
||||
routeToPage(context, PeoplePage(person: result.$1));
|
||||
} else if (result != null && result is PersonEntity) {
|
||||
Navigator.pop(context);
|
||||
// ignore: unawaited_futures
|
||||
routeToPage(context, PeoplePage(person: result));
|
||||
}
|
||||
} else {
|
||||
showShortToast(context, "No personID or clusterID");
|
||||
}
|
||||
},
|
||||
? Dismissible(
|
||||
key: const Key("namingBanner"),
|
||||
direction: DismissDirection.horizontal,
|
||||
onDismissed: (direction) {
|
||||
setState(() {
|
||||
userDismissedNamingBanner = true;
|
||||
});
|
||||
},
|
||||
child: PeopleBanner(
|
||||
type: PeopleBannerType.addName,
|
||||
faceWidget: PersonFaceWidget(
|
||||
files.first,
|
||||
clusterID: widget.clusterID,
|
||||
),
|
||||
actionIcon: Icons.add_outlined,
|
||||
text: S.of(context).addAName,
|
||||
subText: S.of(context).findPeopleByName,
|
||||
onTap: () async {
|
||||
if (widget.personID == null) {
|
||||
final result = await showAssignPersonAction(
|
||||
context,
|
||||
clusterID: widget.clusterID,
|
||||
);
|
||||
if (result != null &&
|
||||
result is (PersonEntity, EnteFile)) {
|
||||
Navigator.pop(context);
|
||||
// ignore: unawaited_futures
|
||||
routeToPage(context, PeoplePage(person: result.$1));
|
||||
} else if (result != null && result is PersonEntity) {
|
||||
Navigator.pop(context);
|
||||
// ignore: unawaited_futures
|
||||
routeToPage(context, PeoplePage(person: result));
|
||||
}
|
||||
} else {
|
||||
showShortToast(context, "No personID or clusterID");
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
|
|
|
@ -38,17 +38,12 @@ class _PersonClustersPageState extends State<PersonClustersPage> {
|
|||
.getClusterFilesForPersonID(widget.person.remoteID),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
final clusters = snapshot.data!;
|
||||
final List<int> keys = clusters.keys.toList();
|
||||
// Sort the clusters by the number of files in each cluster, largest first
|
||||
keys.sort(
|
||||
(b, a) => clusters[a]!.length.compareTo(clusters[b]!.length),
|
||||
);
|
||||
final List<int> keys = snapshot.data!.keys.toList();
|
||||
return ListView.builder(
|
||||
itemCount: keys.length,
|
||||
itemBuilder: (context, index) {
|
||||
final int clusterID = keys[index];
|
||||
final List<EnteFile> files = clusters[clusterID]!;
|
||||
final List<EnteFile> files = snapshot.data![keys[index]]!;
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
|
@ -98,37 +93,34 @@ class _PersonClustersPageState extends State<PersonClustersPage> {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"${files.length} photos",
|
||||
"${snapshot.data![keys[index]]!.length} photos",
|
||||
style: getEnteTextTheme(context).body,
|
||||
),
|
||||
(index != 0)
|
||||
? GestureDetector(
|
||||
onTap: () async {
|
||||
try {
|
||||
await PersonService.instance
|
||||
.removeClusterToPerson(
|
||||
personID: widget.person.remoteID,
|
||||
clusterID: clusterID,
|
||||
);
|
||||
_logger.info(
|
||||
"Removed cluster $clusterID from person ${widget.person.remoteID}",
|
||||
);
|
||||
Bus.instance
|
||||
.fire(PeopleChangedEvent());
|
||||
setState(() {});
|
||||
} catch (e) {
|
||||
_logger.severe(
|
||||
"removing cluster from person,",
|
||||
e,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Icon(
|
||||
CupertinoIcons.minus_circled,
|
||||
color: Colors.red,
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
try {
|
||||
await PersonService.instance
|
||||
.removeClusterToPerson(
|
||||
personID: widget.person.remoteID,
|
||||
clusterID: clusterID,
|
||||
);
|
||||
_logger.info(
|
||||
"Removed cluster $clusterID from person ${widget.person.remoteID}",
|
||||
);
|
||||
Bus.instance.fire(PeopleChangedEvent());
|
||||
setState(() {});
|
||||
} catch (e) {
|
||||
_logger.severe(
|
||||
"removing cluster from person,",
|
||||
e,
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Icon(
|
||||
CupertinoIcons.minus_circled,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -218,3 +218,11 @@ void shareSelected(
|
|||
shareButtonKey: shareButtonKey,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> shareImageAndUrl(
|
||||
BuildContext context,
|
||||
String imagePath,
|
||||
String url,
|
||||
) async {
|
||||
await Share.shareFiles([imagePath], text: url);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ description: ente photos application
|
|||
# Read more about iOS versioning at
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
|
||||
version: 0.8.112+636
|
||||
version: 0.8.110+634
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
|
|
|
@ -153,12 +153,12 @@ const Title_ = styled("div")`
|
|||
`;
|
||||
|
||||
interface WatchList {
|
||||
watches: FolderWatch[] | undefined;
|
||||
watches: FolderWatch[];
|
||||
removeWatch: (watch: FolderWatch) => void;
|
||||
}
|
||||
|
||||
const WatchList: React.FC<WatchList> = ({ watches, removeWatch }) => {
|
||||
return (watches ?? []).length === 0 ? (
|
||||
return watches.length === 0 ? (
|
||||
<NoWatches />
|
||||
) : (
|
||||
<WatchesContainer>
|
||||
|
|
Loading…
Add table
Reference in a new issue