feat-add-files-from-qr (#8)

Reviewed-on: http://catelliub.zapto.org:3000/brontomark/flux/pulls/8
Co-authored-by: Mark M2 Macbook <marco@catelli.it>
Co-committed-by: Mark M2 Macbook <marco@catelli.it>
This commit is contained in:
2026-04-26 10:15:34 +02:00
committed by brontomark
parent 90bd5ecacf
commit 1c2bcf9df7
46 changed files with 2376 additions and 327 deletions

View File

@@ -7,7 +7,7 @@ class ServiceFileModel extends Equatable {
final DateTime? createdAt;
final String name;
final String extension;
final String url;
final String storagePath;
final String serviceId;
final int fileSize;
final Uint8List? localBytes;
@@ -17,12 +17,14 @@ class ServiceFileModel extends Equatable {
this.createdAt,
required this.name,
required this.extension,
required this.url,
required this.storagePath,
required this.serviceId,
required this.fileSize,
this.localBytes,
});
bool get isLocal => localBytes != null;
// Trasforma i byte in qualcosa di leggibile (KB, MB, GB)
String get sizeFormatted {
if (fileSize <= 0) return "0 B";
@@ -40,7 +42,7 @@ class ServiceFileModel extends Equatable {
DateTime? createdAt,
String? name,
String? extension,
String? url,
String? storagePath,
String? serviceId,
int? fileSize,
Uint8List? localBytes,
@@ -50,7 +52,7 @@ class ServiceFileModel extends Equatable {
createdAt: createdAt ?? this.createdAt,
name: name ?? this.name,
extension: extension ?? this.extension,
url: url ?? this.url,
storagePath: storagePath ?? this.storagePath,
serviceId: serviceId ?? this.serviceId,
fileSize: fileSize ?? this.fileSize,
localBytes: localBytes ?? this.localBytes,
@@ -65,7 +67,7 @@ class ServiceFileModel extends Equatable {
: null,
name: map['name'] ?? '',
extension: map['extension'] ?? '',
url: map['url'] ?? '',
storagePath: map['storage_path'] ?? '',
serviceId: map['service_id']?.toString() ?? '',
fileSize: map['file_size'] is int
? map['file_size']
@@ -78,7 +80,7 @@ class ServiceFileModel extends Equatable {
if (id != null) 'id': id,
'name': name,
'extension': extension,
'url': url,
'storage_path': storagePath,
'service_id': serviceId,
'file_size': fileSize,
};
@@ -90,7 +92,7 @@ class ServiceFileModel extends Equatable {
createdAt,
name,
extension,
url,
storagePath,
serviceId,
fileSize,
localBytes,