mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
Transfer repository from Gitlab
This commit is contained in:
parent
af2efbdbbd
commit
568cc243f0
177 changed files with 13300 additions and 0 deletions
77
mobile/lib/shared/models/backup_state.model.dart
Normal file
77
mobile/lib/shared/models/backup_state.model.dart
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
||||
|
||||
enum BackUpProgressEnum { idle, inProgress, done }
|
||||
|
||||
class BackUpState {
|
||||
final BackUpProgressEnum backupProgress;
|
||||
final int totalAssetCount;
|
||||
final int assetOnDatabase;
|
||||
final int backingUpAssetCount;
|
||||
final double progressInPercentage;
|
||||
final CancelToken cancelToken;
|
||||
final ServerInfo serverInfo;
|
||||
|
||||
BackUpState({
|
||||
required this.backupProgress,
|
||||
required this.totalAssetCount,
|
||||
required this.assetOnDatabase,
|
||||
required this.backingUpAssetCount,
|
||||
required this.progressInPercentage,
|
||||
required this.cancelToken,
|
||||
required this.serverInfo,
|
||||
});
|
||||
|
||||
BackUpState copyWith({
|
||||
BackUpProgressEnum? backupProgress,
|
||||
int? totalAssetCount,
|
||||
int? assetOnDatabase,
|
||||
int? backingUpAssetCount,
|
||||
double? progressInPercentage,
|
||||
CancelToken? cancelToken,
|
||||
ServerInfo? serverInfo,
|
||||
}) {
|
||||
return BackUpState(
|
||||
backupProgress: backupProgress ?? this.backupProgress,
|
||||
totalAssetCount: totalAssetCount ?? this.totalAssetCount,
|
||||
assetOnDatabase: assetOnDatabase ?? this.assetOnDatabase,
|
||||
backingUpAssetCount: backingUpAssetCount ?? this.backingUpAssetCount,
|
||||
progressInPercentage: progressInPercentage ?? this.progressInPercentage,
|
||||
cancelToken: cancelToken ?? this.cancelToken,
|
||||
serverInfo: serverInfo ?? this.serverInfo,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'BackUpState(backupProgress: $backupProgress, totalAssetCount: $totalAssetCount, assetOnDatabase: $assetOnDatabase, backingUpAssetCount: $backingUpAssetCount, progressInPercentage: $progressInPercentage, cancelToken: $cancelToken, serverInfo: $serverInfo)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is BackUpState &&
|
||||
other.backupProgress == backupProgress &&
|
||||
other.totalAssetCount == totalAssetCount &&
|
||||
other.assetOnDatabase == assetOnDatabase &&
|
||||
other.backingUpAssetCount == backingUpAssetCount &&
|
||||
other.progressInPercentage == progressInPercentage &&
|
||||
other.cancelToken == cancelToken &&
|
||||
other.serverInfo == serverInfo;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return backupProgress.hashCode ^
|
||||
totalAssetCount.hashCode ^
|
||||
assetOnDatabase.hashCode ^
|
||||
backingUpAssetCount.hashCode ^
|
||||
progressInPercentage.hashCode ^
|
||||
cancelToken.hashCode ^
|
||||
serverInfo.hashCode;
|
||||
}
|
||||
}
|
||||
100
mobile/lib/shared/models/device_info.model.dart
Normal file
100
mobile/lib/shared/models/device_info.model.dart
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
class DeviceInfoRemote {
|
||||
final int id;
|
||||
final String userId;
|
||||
final String deviceId;
|
||||
final String deviceType;
|
||||
final String notificationToken;
|
||||
final String createdAt;
|
||||
final bool isAutoBackup;
|
||||
|
||||
DeviceInfoRemote({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.deviceId,
|
||||
required this.deviceType,
|
||||
required this.notificationToken,
|
||||
required this.createdAt,
|
||||
required this.isAutoBackup,
|
||||
});
|
||||
|
||||
DeviceInfoRemote copyWith({
|
||||
int? id,
|
||||
String? userId,
|
||||
String? deviceId,
|
||||
String? deviceType,
|
||||
String? notificationToken,
|
||||
String? createdAt,
|
||||
bool? isAutoBackup,
|
||||
}) {
|
||||
return DeviceInfoRemote(
|
||||
id: id ?? this.id,
|
||||
userId: userId ?? this.userId,
|
||||
deviceId: deviceId ?? this.deviceId,
|
||||
deviceType: deviceType ?? this.deviceType,
|
||||
notificationToken: notificationToken ?? this.notificationToken,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
isAutoBackup: isAutoBackup ?? this.isAutoBackup,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'userId': userId,
|
||||
'deviceId': deviceId,
|
||||
'deviceType': deviceType,
|
||||
'notificationToken': notificationToken,
|
||||
'createdAt': createdAt,
|
||||
'isAutoBackup': isAutoBackup,
|
||||
};
|
||||
}
|
||||
|
||||
factory DeviceInfoRemote.fromMap(Map<String, dynamic> map) {
|
||||
return DeviceInfoRemote(
|
||||
id: map['id']?.toInt() ?? 0,
|
||||
userId: map['userId'] ?? '',
|
||||
deviceId: map['deviceId'] ?? '',
|
||||
deviceType: map['deviceType'] ?? '',
|
||||
notificationToken: map['notificationToken'] ?? '',
|
||||
createdAt: map['createdAt'] ?? '',
|
||||
isAutoBackup: map['isAutoBackup'] ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory DeviceInfoRemote.fromJson(String source) => DeviceInfoRemote.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DeviceInfo(id: $id, userId: $userId, deviceId: $deviceId, deviceType: $deviceType, notificationToken: $notificationToken, createdAt: $createdAt, isAutoBackup: $isAutoBackup)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is DeviceInfoRemote &&
|
||||
other.id == id &&
|
||||
other.userId == userId &&
|
||||
other.deviceId == deviceId &&
|
||||
other.deviceType == deviceType &&
|
||||
other.notificationToken == notificationToken &&
|
||||
other.createdAt == createdAt &&
|
||||
other.isAutoBackup == isAutoBackup;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return id.hashCode ^
|
||||
userId.hashCode ^
|
||||
deviceId.hashCode ^
|
||||
deviceType.hashCode ^
|
||||
notificationToken.hashCode ^
|
||||
createdAt.hashCode ^
|
||||
isAutoBackup.hashCode;
|
||||
}
|
||||
}
|
||||
11
mobile/lib/shared/models/image_viewer_page_data.model.dart
Normal file
11
mobile/lib/shared/models/image_viewer_page_data.model.dart
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
class ImageViewerPageData {
|
||||
final String heroTag;
|
||||
final String imageUrl;
|
||||
final String thumbnailUrl;
|
||||
|
||||
ImageViewerPageData({
|
||||
required this.heroTag,
|
||||
required this.imageUrl,
|
||||
required this.thumbnailUrl,
|
||||
});
|
||||
}
|
||||
131
mobile/lib/shared/models/immich_asset.model.dart
Normal file
131
mobile/lib/shared/models/immich_asset.model.dart
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
import 'dart:convert';
|
||||
|
||||
class ImmichAsset {
|
||||
final String id;
|
||||
final String deviceAssetId;
|
||||
final String userId;
|
||||
final String deviceId;
|
||||
final String assetType;
|
||||
final String localPath;
|
||||
final String remotePath;
|
||||
final String createdAt;
|
||||
final String modifiedAt;
|
||||
final bool isFavorite;
|
||||
final String? description;
|
||||
|
||||
ImmichAsset({
|
||||
required this.id,
|
||||
required this.deviceAssetId,
|
||||
required this.userId,
|
||||
required this.deviceId,
|
||||
required this.assetType,
|
||||
required this.localPath,
|
||||
required this.remotePath,
|
||||
required this.createdAt,
|
||||
required this.modifiedAt,
|
||||
required this.isFavorite,
|
||||
this.description,
|
||||
});
|
||||
|
||||
ImmichAsset copyWith({
|
||||
String? id,
|
||||
String? deviceAssetId,
|
||||
String? userId,
|
||||
String? deviceId,
|
||||
String? assetType,
|
||||
String? localPath,
|
||||
String? remotePath,
|
||||
String? createdAt,
|
||||
String? modifiedAt,
|
||||
bool? isFavorite,
|
||||
String? description,
|
||||
}) {
|
||||
return ImmichAsset(
|
||||
id: id ?? this.id,
|
||||
deviceAssetId: deviceAssetId ?? this.deviceAssetId,
|
||||
userId: userId ?? this.userId,
|
||||
deviceId: deviceId ?? this.deviceId,
|
||||
assetType: assetType ?? this.assetType,
|
||||
localPath: localPath ?? this.localPath,
|
||||
remotePath: remotePath ?? this.remotePath,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
modifiedAt: modifiedAt ?? this.modifiedAt,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
description: description ?? this.description,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'id': id,
|
||||
'deviceAssetId': deviceAssetId,
|
||||
'userId': userId,
|
||||
'deviceId': deviceId,
|
||||
'assetType': assetType,
|
||||
'localPath': localPath,
|
||||
'remotePath': remotePath,
|
||||
'createdAt': createdAt,
|
||||
'modifiedAt': modifiedAt,
|
||||
'isFavorite': isFavorite,
|
||||
'description': description,
|
||||
};
|
||||
}
|
||||
|
||||
factory ImmichAsset.fromMap(Map<String, dynamic> map) {
|
||||
return ImmichAsset(
|
||||
id: map['id'] ?? '',
|
||||
deviceAssetId: map['deviceAssetId'] ?? '',
|
||||
userId: map['userId'] ?? '',
|
||||
deviceId: map['deviceId'] ?? '',
|
||||
assetType: map['assetType'] ?? '',
|
||||
localPath: map['localPath'] ?? '',
|
||||
remotePath: map['remotePath'] ?? '',
|
||||
createdAt: map['createdAt'] ?? '',
|
||||
modifiedAt: map['modifiedAt'] ?? '',
|
||||
isFavorite: map['isFavorite'] ?? false,
|
||||
description: map['description'],
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory ImmichAsset.fromJson(String source) => ImmichAsset.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ImmichAsset(id: $id, deviceAssetId: $deviceAssetId, userId: $userId, deviceId: $deviceId, assetType: $assetType, localPath: $localPath, remotePath: $remotePath, createdAt: $createdAt, modifiedAt: $modifiedAt, isFavorite: $isFavorite, description: $description)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is ImmichAsset &&
|
||||
other.id == id &&
|
||||
other.deviceAssetId == deviceAssetId &&
|
||||
other.userId == userId &&
|
||||
other.deviceId == deviceId &&
|
||||
other.assetType == assetType &&
|
||||
other.localPath == localPath &&
|
||||
other.remotePath == remotePath &&
|
||||
other.createdAt == createdAt &&
|
||||
other.modifiedAt == modifiedAt &&
|
||||
other.isFavorite == isFavorite &&
|
||||
other.description == description;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return id.hashCode ^
|
||||
deviceAssetId.hashCode ^
|
||||
userId.hashCode ^
|
||||
deviceId.hashCode ^
|
||||
assetType.hashCode ^
|
||||
localPath.hashCode ^
|
||||
remotePath.hashCode ^
|
||||
createdAt.hashCode ^
|
||||
modifiedAt.hashCode ^
|
||||
isFavorite.hashCode ^
|
||||
description.hashCode;
|
||||
}
|
||||
}
|
||||
98
mobile/lib/shared/models/server_info.model.dart
Normal file
98
mobile/lib/shared/models/server_info.model.dart
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
import 'dart:convert';
|
||||
|
||||
class ServerInfo {
|
||||
final String diskSize;
|
||||
final String diskUse;
|
||||
final String diskAvailable;
|
||||
final int diskSizeRaw;
|
||||
final int diskUseRaw;
|
||||
final int diskAvailableRaw;
|
||||
final double diskUsagePercentage;
|
||||
ServerInfo({
|
||||
required this.diskSize,
|
||||
required this.diskUse,
|
||||
required this.diskAvailable,
|
||||
required this.diskSizeRaw,
|
||||
required this.diskUseRaw,
|
||||
required this.diskAvailableRaw,
|
||||
required this.diskUsagePercentage,
|
||||
});
|
||||
|
||||
ServerInfo copyWith({
|
||||
String? diskSize,
|
||||
String? diskUse,
|
||||
String? diskAvailable,
|
||||
int? diskSizeRaw,
|
||||
int? diskUseRaw,
|
||||
int? diskAvailableRaw,
|
||||
double? diskUsagePercentage,
|
||||
}) {
|
||||
return ServerInfo(
|
||||
diskSize: diskSize ?? this.diskSize,
|
||||
diskUse: diskUse ?? this.diskUse,
|
||||
diskAvailable: diskAvailable ?? this.diskAvailable,
|
||||
diskSizeRaw: diskSizeRaw ?? this.diskSizeRaw,
|
||||
diskUseRaw: diskUseRaw ?? this.diskUseRaw,
|
||||
diskAvailableRaw: diskAvailableRaw ?? this.diskAvailableRaw,
|
||||
diskUsagePercentage: diskUsagePercentage ?? this.diskUsagePercentage,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'diskSize': diskSize,
|
||||
'diskUse': diskUse,
|
||||
'diskAvailable': diskAvailable,
|
||||
'diskSizeRaw': diskSizeRaw,
|
||||
'diskUseRaw': diskUseRaw,
|
||||
'diskAvailableRaw': diskAvailableRaw,
|
||||
'diskUsagePercentage': diskUsagePercentage,
|
||||
};
|
||||
}
|
||||
|
||||
factory ServerInfo.fromMap(Map<String, dynamic> map) {
|
||||
return ServerInfo(
|
||||
diskSize: map['diskSize'] ?? '',
|
||||
diskUse: map['diskUse'] ?? '',
|
||||
diskAvailable: map['diskAvailable'] ?? '',
|
||||
diskSizeRaw: map['diskSizeRaw']?.toInt() ?? 0,
|
||||
diskUseRaw: map['diskUseRaw']?.toInt() ?? 0,
|
||||
diskAvailableRaw: map['diskAvailableRaw']?.toInt() ?? 0,
|
||||
diskUsagePercentage: map['diskUsagePercentage']?.toDouble() ?? 0.0,
|
||||
);
|
||||
}
|
||||
|
||||
String toJson() => json.encode(toMap());
|
||||
|
||||
factory ServerInfo.fromJson(String source) => ServerInfo.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ServerInfo(diskSize: $diskSize, diskUse: $diskUse, diskAvailable: $diskAvailable, diskSizeRaw: $diskSizeRaw, diskUseRaw: $diskUseRaw, diskAvailableRaw: $diskAvailableRaw, diskUsagePercentage: $diskUsagePercentage)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is ServerInfo &&
|
||||
other.diskSize == diskSize &&
|
||||
other.diskUse == diskUse &&
|
||||
other.diskAvailable == diskAvailable &&
|
||||
other.diskSizeRaw == diskSizeRaw &&
|
||||
other.diskUseRaw == diskUseRaw &&
|
||||
other.diskAvailableRaw == diskAvailableRaw &&
|
||||
other.diskUsagePercentage == diskUsagePercentage;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return diskSize.hashCode ^
|
||||
diskUse.hashCode ^
|
||||
diskAvailable.hashCode ^
|
||||
diskSizeRaw.hashCode ^
|
||||
diskUseRaw.hashCode ^
|
||||
diskAvailableRaw.hashCode ^
|
||||
diskUsagePercentage.hashCode;
|
||||
}
|
||||
}
|
||||
13
mobile/lib/shared/providers/app_state.provider.dart
Normal file
13
mobile/lib/shared/providers/app_state.provider.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
enum AppStateEnum {
|
||||
active,
|
||||
inactive,
|
||||
paused,
|
||||
resumed,
|
||||
detached,
|
||||
}
|
||||
|
||||
final appStateProvider = StateProvider<AppStateEnum>((ref) {
|
||||
return AppStateEnum.active;
|
||||
});
|
||||
137
mobile/lib/shared/providers/backup.provider.dart
Normal file
137
mobile/lib/shared/providers/backup.provider.dart
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/shared/services/server_info.service.dart';
|
||||
import 'package:immich_mobile/shared/models/backup_state.model.dart';
|
||||
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
||||
import 'package:immich_mobile/shared/services/backup.service.dart';
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
|
||||
class BackupNotifier extends StateNotifier<BackUpState> {
|
||||
BackupNotifier()
|
||||
: super(
|
||||
BackUpState(
|
||||
backupProgress: BackUpProgressEnum.idle,
|
||||
backingUpAssetCount: 0,
|
||||
assetOnDatabase: 0,
|
||||
totalAssetCount: 0,
|
||||
progressInPercentage: 0,
|
||||
cancelToken: CancelToken(),
|
||||
serverInfo: ServerInfo(
|
||||
diskAvailable: "0",
|
||||
diskAvailableRaw: 0,
|
||||
diskSize: "0",
|
||||
diskSizeRaw: 0,
|
||||
diskUsagePercentage: 0.0,
|
||||
diskUse: "0",
|
||||
diskUseRaw: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final BackupService _backupService = BackupService();
|
||||
final ServerInfoService _serverInfoService = ServerInfoService();
|
||||
|
||||
void getBackupInfo() async {
|
||||
_updateServerInfo();
|
||||
|
||||
List<AssetPathEntity> list = await PhotoManager.getAssetPathList(onlyAll: true, type: RequestType.image);
|
||||
|
||||
if (list.isEmpty) {
|
||||
debugPrint("No Asset On Device");
|
||||
return;
|
||||
}
|
||||
|
||||
int totalAsset = list[0].assetCount;
|
||||
List<String> didBackupAsset = await _backupService.getDeviceBackupAsset();
|
||||
|
||||
state = state.copyWith(totalAssetCount: totalAsset, assetOnDatabase: didBackupAsset.length);
|
||||
}
|
||||
|
||||
void startBackupProcess() async {
|
||||
_updateServerInfo();
|
||||
|
||||
state = state.copyWith(backupProgress: BackUpProgressEnum.inProgress);
|
||||
|
||||
var authResult = await PhotoManager.requestPermissionExtend();
|
||||
if (authResult.isAuth) {
|
||||
await PhotoManager.clearFileCache();
|
||||
// await PhotoManager.presentLimited();
|
||||
// Gather assets info
|
||||
List<AssetPathEntity> list =
|
||||
await PhotoManager.getAssetPathList(hasAll: true, onlyAll: true, type: RequestType.image);
|
||||
|
||||
if (list.isEmpty) {
|
||||
debugPrint("No Asset On Device - Abort Backup Process");
|
||||
return;
|
||||
}
|
||||
|
||||
int totalAsset = list[0].assetCount;
|
||||
List<AssetEntity> currentAssets = await list[0].getAssetListRange(start: 0, end: totalAsset);
|
||||
|
||||
// Get device assets info from database
|
||||
// Compare and find different assets that has not been backing up
|
||||
// Backup those assets
|
||||
List<String> backupAsset = await _backupService.getDeviceBackupAsset();
|
||||
|
||||
state = state.copyWith(totalAssetCount: totalAsset, assetOnDatabase: backupAsset.length);
|
||||
// Remove item that has already been backed up
|
||||
for (var backupAssetId in backupAsset) {
|
||||
currentAssets.removeWhere((e) => e.id == backupAssetId);
|
||||
}
|
||||
|
||||
if (currentAssets.isEmpty) {
|
||||
state = state.copyWith(backupProgress: BackUpProgressEnum.idle);
|
||||
}
|
||||
|
||||
state = state.copyWith(backingUpAssetCount: currentAssets.length);
|
||||
|
||||
// Perform Packup
|
||||
state = state.copyWith(cancelToken: CancelToken());
|
||||
_backupService.backupAsset(currentAssets, state.cancelToken, _onAssetUploaded, _onUploadProgress);
|
||||
} else {
|
||||
PhotoManager.openSetting();
|
||||
}
|
||||
}
|
||||
|
||||
void cancelBackup() {
|
||||
state.cancelToken.cancel('Cancel Backup');
|
||||
state = state.copyWith(backupProgress: BackUpProgressEnum.idle);
|
||||
}
|
||||
|
||||
void _onAssetUploaded() {
|
||||
state =
|
||||
state.copyWith(backingUpAssetCount: state.backingUpAssetCount - 1, assetOnDatabase: state.assetOnDatabase + 1);
|
||||
|
||||
if (state.backingUpAssetCount == 0) {
|
||||
state = state.copyWith(backupProgress: BackUpProgressEnum.done, progressInPercentage: 0.0);
|
||||
}
|
||||
|
||||
_updateServerInfo();
|
||||
}
|
||||
|
||||
void _onUploadProgress(int sent, int total) {
|
||||
state = state.copyWith(progressInPercentage: (sent.toDouble() / total.toDouble() * 100));
|
||||
}
|
||||
|
||||
void _updateServerInfo() async {
|
||||
var serverInfo = await _serverInfoService.getServerInfo();
|
||||
|
||||
// Update server info
|
||||
state = state.copyWith(
|
||||
serverInfo: ServerInfo(
|
||||
diskSize: serverInfo.diskSize,
|
||||
diskUse: serverInfo.diskUse,
|
||||
diskAvailable: serverInfo.diskAvailable,
|
||||
diskSizeRaw: serverInfo.diskSizeRaw,
|
||||
diskUseRaw: serverInfo.diskUseRaw,
|
||||
diskAvailableRaw: serverInfo.diskAvailableRaw,
|
||||
diskUsagePercentage: serverInfo.diskUsagePercentage,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final backupProvider = StateNotifierProvider<BackupNotifier, BackUpState>((ref) {
|
||||
return BackupNotifier();
|
||||
});
|
||||
124
mobile/lib/shared/services/backup.service.dart
Normal file
124
mobile/lib/shared/services/backup.service.dart
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
||||
import 'package:immich_mobile/shared/models/device_info.model.dart';
|
||||
import 'package:immich_mobile/utils/dio_http_interceptor.dart';
|
||||
import 'package:immich_mobile/utils/files_helper.dart';
|
||||
import 'package:photo_manager/photo_manager.dart';
|
||||
import 'package:http_parser/http_parser.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:exif/exif.dart';
|
||||
|
||||
class BackupService {
|
||||
final NetworkService _networkService = NetworkService();
|
||||
|
||||
Future<List<String>> getDeviceBackupAsset() async {
|
||||
String deviceId = Hive.box(userInfoBox).get(deviceIdKey);
|
||||
|
||||
Response response = await _networkService.getRequest(url: "asset/$deviceId");
|
||||
List<dynamic> result = jsonDecode(response.toString());
|
||||
|
||||
return result.cast<String>();
|
||||
}
|
||||
|
||||
backupAsset(List<AssetEntity> assetList, CancelToken cancelToken, Function singleAssetDoneCb,
|
||||
Function(int, int) uploadProgress) async {
|
||||
var dio = Dio();
|
||||
dio.interceptors.add(AuthenticatedRequestInterceptor());
|
||||
String deviceId = Hive.box(userInfoBox).get(deviceIdKey);
|
||||
String savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
File? file;
|
||||
|
||||
for (var entity in assetList) {
|
||||
try {
|
||||
file = await entity.file.timeout(const Duration(seconds: 5));
|
||||
|
||||
if (file != null) {
|
||||
// reading exif
|
||||
// var exifData = await readExifFromFile(file);
|
||||
|
||||
// for (String key in exifData.keys) {
|
||||
// debugPrint("- $key (${exifData[key]?.tagType}): ${exifData[key]}");
|
||||
// }
|
||||
|
||||
// debugPrint("------------------");
|
||||
String originalFileName = await entity.titleAsync;
|
||||
String fileNameWithoutPath = originalFileName.toString().split(".")[0];
|
||||
var fileExtension = p.extension(file.path);
|
||||
LatLng coordinate = await entity.latlngAsync();
|
||||
var mimeType = FileHelper.getMimeType(file.path);
|
||||
var formData = FormData.fromMap({
|
||||
'deviceAssetId': entity.id,
|
||||
'deviceId': deviceId,
|
||||
'assetType': _getAssetType(entity.type),
|
||||
'createdAt': entity.createDateTime.toIso8601String(),
|
||||
'modifiedAt': entity.modifiedDateTime.toIso8601String(),
|
||||
'isFavorite': entity.isFavorite,
|
||||
'fileExtension': fileExtension,
|
||||
'lat': coordinate.latitude,
|
||||
'lon': coordinate.longitude,
|
||||
'files': [
|
||||
await MultipartFile.fromFile(
|
||||
file.path,
|
||||
filename: fileNameWithoutPath,
|
||||
contentType: MediaType(
|
||||
mimeType["type"],
|
||||
mimeType["subType"],
|
||||
),
|
||||
),
|
||||
]
|
||||
});
|
||||
|
||||
Response res = await dio.post(
|
||||
'$savedEndpoint/asset/upload',
|
||||
data: formData,
|
||||
cancelToken: cancelToken,
|
||||
onSendProgress: (sent, total) => uploadProgress(sent, total),
|
||||
);
|
||||
|
||||
if (res.statusCode == 201) {
|
||||
singleAssetDoneCb();
|
||||
}
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
debugPrint("DioError backupAsset: ${e.response}");
|
||||
break;
|
||||
} catch (e) {
|
||||
debugPrint("ERROR backupAsset: ${e.toString()}");
|
||||
continue;
|
||||
} finally {
|
||||
if (Platform.isIOS) {
|
||||
file?.deleteSync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String _getAssetType(AssetType assetType) {
|
||||
switch (assetType) {
|
||||
case AssetType.audio:
|
||||
return "AUDIO";
|
||||
case AssetType.image:
|
||||
return "IMAGE";
|
||||
case AssetType.video:
|
||||
return "VIDEO";
|
||||
case AssetType.other:
|
||||
return "OTHER";
|
||||
}
|
||||
}
|
||||
|
||||
Future<DeviceInfoRemote> setAutoBackup(bool status, String deviceId, String deviceType) async {
|
||||
var res = await _networkService.patchRequest(url: 'device-info', data: {
|
||||
"isAutoBackup": status,
|
||||
"deviceId": deviceId,
|
||||
"deviceType": deviceType,
|
||||
});
|
||||
|
||||
return DeviceInfoRemote.fromJson(res.toString());
|
||||
}
|
||||
}
|
||||
30
mobile/lib/shared/services/device_info.service.dart
Normal file
30
mobile/lib/shared/services/device_info.service.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DeviceInfoService {
|
||||
Future<Map<String, dynamic>> getDeviceInfo() async {
|
||||
// Get device info
|
||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||
String? deviceId = "";
|
||||
String deviceType = "";
|
||||
|
||||
try {
|
||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||
deviceId = androidInfo.androidId;
|
||||
deviceType = "ANDROID";
|
||||
} catch (e) {
|
||||
debugPrint("Not an android device");
|
||||
}
|
||||
|
||||
try {
|
||||
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
||||
deviceId = iosInfo.identifierForVendor;
|
||||
deviceType = "IOS";
|
||||
debugPrint("Device ID: $deviceId");
|
||||
} catch (e) {
|
||||
debugPrint("Not an ios device");
|
||||
}
|
||||
|
||||
return {"deviceId": deviceId, "deviceType": deviceType};
|
||||
}
|
||||
}
|
||||
18
mobile/lib/shared/services/local_storage.service.dart
Normal file
18
mobile/lib/shared/services/local_storage.service.dart
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import 'package:hive/hive.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
|
||||
class LocalStorageService {
|
||||
late Box _box;
|
||||
|
||||
LocalStorageService() {
|
||||
_box = Hive.box(userInfoBox);
|
||||
}
|
||||
|
||||
T get<T>(String key) {
|
||||
return _box.get(key);
|
||||
}
|
||||
|
||||
put<T>(String key, T value) {
|
||||
return _box.put(key, value);
|
||||
}
|
||||
}
|
||||
89
mobile/lib/shared/services/network.service.dart
Normal file
89
mobile/lib/shared/services/network.service.dart
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
import 'package:immich_mobile/utils/dio_http_interceptor.dart';
|
||||
|
||||
class NetworkService {
|
||||
Future<dynamic> getRequest({required String url}) async {
|
||||
try {
|
||||
var dio = Dio();
|
||||
dio.interceptors.add(AuthenticatedRequestInterceptor());
|
||||
|
||||
var savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
Response res = await dio.get('$savedEndpoint/$url');
|
||||
|
||||
if (res.statusCode == 200) {
|
||||
return res;
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
debugPrint("DioError: ${e.response}");
|
||||
} catch (e) {
|
||||
debugPrint("ERROR getRequest: ${e.toString()}");
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> postRequest({required String url, dynamic data}) async {
|
||||
try {
|
||||
var dio = Dio();
|
||||
dio.interceptors.add(AuthenticatedRequestInterceptor());
|
||||
|
||||
var savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
String validUrl = Uri.parse('$savedEndpoint/$url').toString();
|
||||
Response res = await dio.post(validUrl, data: data);
|
||||
|
||||
return res;
|
||||
} on DioError catch (e) {
|
||||
debugPrint("DioError: ${e.response}");
|
||||
return false;
|
||||
} catch (e) {
|
||||
debugPrint("ERROR BackupService: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> patchRequest({required String url, dynamic data}) async {
|
||||
try {
|
||||
var dio = Dio();
|
||||
dio.interceptors.add(AuthenticatedRequestInterceptor());
|
||||
|
||||
var savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
|
||||
String validUrl = Uri.parse('$savedEndpoint/$url').toString();
|
||||
Response res = await dio.patch(validUrl, data: data);
|
||||
|
||||
return res;
|
||||
} on DioError catch (e) {
|
||||
debugPrint("DioError: ${e.response}");
|
||||
} catch (e) {
|
||||
debugPrint("ERROR BackupService: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> pingServer() async {
|
||||
try {
|
||||
var dio = Dio();
|
||||
|
||||
var savedEndpoint = Hive.box(userInfoBox).get(serverEndpointKey);
|
||||
|
||||
String validUrl = Uri.parse('$savedEndpoint/server-info/ping').toString();
|
||||
|
||||
debugPrint("pint server at url $validUrl");
|
||||
Response res = await dio.get(validUrl);
|
||||
var jsonRespsonse = jsonDecode(res.toString());
|
||||
|
||||
if (jsonRespsonse["res"] == "pong") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
debugPrint("[PING SERVER] DioError: ${e.response} - $e");
|
||||
return false;
|
||||
} catch (e) {
|
||||
debugPrint("ERROR BackupService: $e");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
mobile/lib/shared/services/server_info.service.dart
Normal file
15
mobile/lib/shared/services/server_info.service.dart
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
||||
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
||||
|
||||
class ServerInfoService {
|
||||
final NetworkService _networkService = NetworkService();
|
||||
|
||||
Future<ServerInfo> getServerInfo() async {
|
||||
Response response = await _networkService.getRequest(url: 'server-info');
|
||||
|
||||
return ServerInfo.fromJson(response.toString());
|
||||
}
|
||||
}
|
||||
232
mobile/lib/shared/views/backup_controller_page.dart
Normal file
232
mobile/lib/shared/views/backup_controller_page.dart
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/modules/login/models/authentication_state.model.dart';
|
||||
import 'package:immich_mobile/shared/models/backup_state.model.dart';
|
||||
import 'package:immich_mobile/modules/login/providers/authentication.provider.dart';
|
||||
import 'package:immich_mobile/shared/providers/backup.provider.dart';
|
||||
import 'package:percent_indicator/linear_percent_indicator.dart';
|
||||
|
||||
class BackupControllerPage extends HookConsumerWidget {
|
||||
const BackupControllerPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
BackUpState _backupState = ref.watch(backupProvider);
|
||||
AuthenticationState _authenticationState = ref.watch(authenticationProvider);
|
||||
|
||||
bool shouldBackup = _backupState.totalAssetCount - _backupState.assetOnDatabase == 0 ? false : true;
|
||||
|
||||
useEffect(() {
|
||||
if (_backupState.backupProgress != BackUpProgressEnum.inProgress) {
|
||||
ref.read(backupProvider.notifier).getBackupInfo();
|
||||
}
|
||||
}, []);
|
||||
|
||||
Widget _buildStorageInformation() {
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
Icons.storage_rounded,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
title: const Text(
|
||||
"Server Storage",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||
),
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
LinearPercentIndicator(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
lineHeight: 5.0,
|
||||
percent: _backupState.serverInfo.diskUsagePercentage / 100.0,
|
||||
backgroundColor: Colors.grey,
|
||||
progressColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12.0),
|
||||
child: Text('${_backupState.serverInfo.diskUse} of ${_backupState.serverInfo.diskSize} used'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ListTile _buildBackupController() {
|
||||
var backUpOption = _authenticationState.deviceInfo.isAutoBackup ? "on" : "off";
|
||||
var isAutoBackup = _authenticationState.deviceInfo.isAutoBackup;
|
||||
var backupBtnText = _authenticationState.deviceInfo.isAutoBackup ? "off" : "on";
|
||||
return ListTile(
|
||||
isThreeLine: true,
|
||||
leading: isAutoBackup
|
||||
? Icon(
|
||||
Icons.cloud_done_rounded,
|
||||
color: Theme.of(context).primaryColor,
|
||||
)
|
||||
: const Icon(Icons.cloud_off_rounded),
|
||||
title: Text(
|
||||
"Back up is $backUpOption",
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 14),
|
||||
),
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
!isAutoBackup
|
||||
? const Text(
|
||||
"Turn on backup to automatically upload new assets to the server.",
|
||||
style: TextStyle(fontSize: 14),
|
||||
)
|
||||
: Container(),
|
||||
OutlinedButton(
|
||||
onPressed: () {
|
||||
isAutoBackup
|
||||
? ref.watch(authenticationProvider.notifier).setAutoBackup(false)
|
||||
: ref.watch(authenticationProvider.notifier).setAutoBackup(true);
|
||||
},
|
||||
child: Text("Turn $backupBtnText Backup"),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(
|
||||
"Backup",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
AutoRouter.of(context).pop(true);
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back_ios_rounded)),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: ListView(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"Backup Information",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
),
|
||||
),
|
||||
BackupInfoCard(
|
||||
title: "Total",
|
||||
subtitle: "All images and video on the device",
|
||||
info: "${_backupState.totalAssetCount}",
|
||||
),
|
||||
BackupInfoCard(
|
||||
title: "Backup",
|
||||
subtitle: "Images and videos of the device that are backup on server",
|
||||
info: "${_backupState.assetOnDatabase}",
|
||||
),
|
||||
BackupInfoCard(
|
||||
title: "Remainder",
|
||||
subtitle: "Images and videos that has not been backing up",
|
||||
info: "${_backupState.totalAssetCount - _backupState.assetOnDatabase}",
|
||||
),
|
||||
const Divider(),
|
||||
_buildBackupController(),
|
||||
const Divider(),
|
||||
_buildStorageInformation(),
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"Asset that were being backup: ${_backupState.backingUpAssetCount} [${_backupState.progressInPercentage.toStringAsFixed(0)}%]"),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: Row(children: [
|
||||
const Text("Backup Progress:"),
|
||||
const Padding(padding: EdgeInsets.symmetric(horizontal: 2)),
|
||||
_backupState.backupProgress == BackUpProgressEnum.inProgress
|
||||
? const CircularProgressIndicator.adaptive()
|
||||
: const Text("Done"),
|
||||
]),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: _backupState.backupProgress == BackUpProgressEnum.inProgress
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(primary: Colors.red[300]),
|
||||
onPressed: () {
|
||||
ref.read(backupProvider.notifier).cancelBackup();
|
||||
},
|
||||
child: const Text("Cancel"),
|
||||
)
|
||||
: ElevatedButton(
|
||||
onPressed: shouldBackup
|
||||
? () {
|
||||
ref.read(backupProvider.notifier).startBackupProcess();
|
||||
}
|
||||
: null,
|
||||
child: const Text("Start Backup"),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BackupInfoCard extends StatelessWidget {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final String info;
|
||||
const BackupInfoCard({Key? key, required this.title, required this.subtitle, required this.info}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5), // if you need this
|
||||
side: const BorderSide(
|
||||
color: Colors.black12,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
elevation: 0,
|
||||
borderOnForeground: false,
|
||||
child: ListTile(
|
||||
minVerticalPadding: 15,
|
||||
isThreeLine: true,
|
||||
title: Text(
|
||||
title,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
|
||||
),
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
subtitle,
|
||||
style: const TextStyle(color: Color(0xFF808080), fontSize: 12),
|
||||
),
|
||||
),
|
||||
trailing: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
info,
|
||||
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const Text("assets"),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
64
mobile/lib/shared/views/image_viewer_page.dart
Normal file
64
mobile/lib/shared/views/image_viewer_page.dart
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:immich_mobile/constants/hive_box.dart';
|
||||
|
||||
class ImageViewerPage extends StatelessWidget {
|
||||
final String imageUrl;
|
||||
final String heroTag;
|
||||
final String thumbnailUrl;
|
||||
|
||||
const ImageViewerPage({Key? key, required this.imageUrl, required this.heroTag, required this.thumbnailUrl})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var box = Hive.box(userInfoBox);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
appBar: AppBar(
|
||||
toolbarHeight: 60,
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
AutoRouter.of(context).pop();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back_ios)),
|
||||
),
|
||||
body: Dismissible(
|
||||
direction: DismissDirection.vertical,
|
||||
onDismissed: (_) {
|
||||
AutoRouter.of(context).pop();
|
||||
},
|
||||
key: Key(heroTag),
|
||||
child: Center(
|
||||
child: Hero(
|
||||
tag: heroTag,
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: imageUrl,
|
||||
httpHeaders: {"Authorization": "Bearer ${box.get(accessTokenKey)}"},
|
||||
fadeInDuration: const Duration(milliseconds: 250),
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error),
|
||||
placeholder: (context, url) {
|
||||
return CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: thumbnailUrl,
|
||||
httpHeaders: {"Authorization": "Bearer ${box.get(accessTokenKey)}"},
|
||||
placeholderFadeInDuration: const Duration(milliseconds: 0),
|
||||
progressIndicatorBuilder: (context, url, downloadProgress) => Transform.scale(
|
||||
scale: 0.2,
|
||||
child: CircularProgressIndicator(value: downloadProgress.progress),
|
||||
),
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue