mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-27 21:30:23 +02:00
feat: rename History tab to Library and show local library items
- Rename bottom navigation 'History' to 'Library' - Add Local Library section showing scanned tracks below downloaded tracks - Add source badge to each item (Downloaded/Local) for clear identification - Add new localization strings for Library tab and source badges - Local library items can be played directly from the library tab
This commit is contained in:
@@ -202,14 +202,14 @@ class _MainShellState extends ConsumerState<MainShell> {
|
||||
icon: Badge(
|
||||
isLabelVisible: queueState > 0,
|
||||
label: Text('$queueState'),
|
||||
child: const Icon(Icons.history_outlined),
|
||||
child: const Icon(Icons.library_music_outlined),
|
||||
),
|
||||
selectedIcon: Badge(
|
||||
isLabelVisible: queueState > 0,
|
||||
label: Text('$queueState'),
|
||||
child: const Icon(Icons.history),
|
||||
child: const Icon(Icons.library_music),
|
||||
),
|
||||
label: l10n.navHistory,
|
||||
label: l10n.navLibrary,
|
||||
),
|
||||
if (showStore)
|
||||
NavigationDestination(
|
||||
|
||||
+288
-2
@@ -12,9 +12,82 @@ import 'package:spotiflac_android/utils/mime_utils.dart';
|
||||
import 'package:spotiflac_android/models/download_item.dart';
|
||||
import 'package:spotiflac_android/providers/download_queue_provider.dart';
|
||||
import 'package:spotiflac_android/providers/settings_provider.dart';
|
||||
import 'package:spotiflac_android/providers/local_library_provider.dart';
|
||||
import 'package:spotiflac_android/services/library_database.dart';
|
||||
import 'package:spotiflac_android/screens/track_metadata_screen.dart';
|
||||
import 'package:spotiflac_android/screens/downloaded_album_screen.dart';
|
||||
|
||||
/// Represents the source of a library item
|
||||
enum LibraryItemSource { downloaded, local }
|
||||
|
||||
/// Unified library item that can come from download history or local library
|
||||
class UnifiedLibraryItem {
|
||||
final String id;
|
||||
final String trackName;
|
||||
final String artistName;
|
||||
final String albumName;
|
||||
final String? coverUrl;
|
||||
final String filePath;
|
||||
final String? quality;
|
||||
final DateTime addedAt;
|
||||
final LibraryItemSource source;
|
||||
|
||||
// Original items for navigation
|
||||
final DownloadHistoryItem? historyItem;
|
||||
final LocalLibraryItem? localItem;
|
||||
|
||||
UnifiedLibraryItem({
|
||||
required this.id,
|
||||
required this.trackName,
|
||||
required this.artistName,
|
||||
required this.albumName,
|
||||
this.coverUrl,
|
||||
required this.filePath,
|
||||
this.quality,
|
||||
required this.addedAt,
|
||||
required this.source,
|
||||
this.historyItem,
|
||||
this.localItem,
|
||||
});
|
||||
|
||||
factory UnifiedLibraryItem.fromDownloadHistory(DownloadHistoryItem item) {
|
||||
return UnifiedLibraryItem(
|
||||
id: 'dl_${item.id}',
|
||||
trackName: item.trackName,
|
||||
artistName: item.artistName,
|
||||
albumName: item.albumName,
|
||||
coverUrl: item.coverUrl,
|
||||
filePath: item.filePath,
|
||||
quality: item.quality,
|
||||
addedAt: item.downloadedAt,
|
||||
source: LibraryItemSource.downloaded,
|
||||
historyItem: item,
|
||||
);
|
||||
}
|
||||
|
||||
factory UnifiedLibraryItem.fromLocalLibrary(LocalLibraryItem item) {
|
||||
String? quality;
|
||||
if (item.bitDepth != null && item.sampleRate != null) {
|
||||
quality = '${item.bitDepth}bit/${(item.sampleRate! / 1000).toStringAsFixed(1)}kHz';
|
||||
}
|
||||
return UnifiedLibraryItem(
|
||||
id: 'local_${item.id}',
|
||||
trackName: item.trackName,
|
||||
artistName: item.artistName,
|
||||
albumName: item.albumName,
|
||||
coverUrl: null, // Local library doesn't have cover URLs
|
||||
filePath: item.filePath,
|
||||
quality: quality,
|
||||
addedAt: item.scannedAt,
|
||||
source: LibraryItemSource.local,
|
||||
localItem: item,
|
||||
);
|
||||
}
|
||||
|
||||
String get searchKey => '${trackName.toLowerCase()}|${artistName.toLowerCase()}|${albumName.toLowerCase()}';
|
||||
String get albumKey => '$albumName|$artistName';
|
||||
}
|
||||
|
||||
class _GroupedAlbum {
|
||||
final String albumName;
|
||||
final String artistName;
|
||||
@@ -664,6 +737,12 @@ final queueItems = ref.watch(downloadQueueProvider.select((s) => s.items));
|
||||
final allHistoryItems = ref.watch(
|
||||
downloadHistoryProvider.select((s) => s.items),
|
||||
);
|
||||
// Watch local library items
|
||||
final localLibraryEnabled = ref.watch(settingsProvider.select((s) => s.localLibraryEnabled));
|
||||
final localLibraryItems = localLibraryEnabled
|
||||
? ref.watch(localLibraryProvider.select((s) => s.items))
|
||||
: <LocalLibraryItem>[];
|
||||
|
||||
_ensureHistoryCaches(allHistoryItems);
|
||||
final historyViewMode = ref.watch(
|
||||
settingsProvider.select((s) => s.historyViewMode),
|
||||
@@ -720,7 +799,7 @@ final queueItems = ref.watch(downloadQueueProvider.select((s) => s.items));
|
||||
expandedTitleScale: 1.0,
|
||||
titlePadding: const EdgeInsets.only(left: 24, bottom: 16),
|
||||
title: Text(
|
||||
context.l10n.historyTitle,
|
||||
context.l10n.navLibrary,
|
||||
style: TextStyle(
|
||||
fontSize: 20 + (14 * expandRatio),
|
||||
fontWeight: FontWeight.bold,
|
||||
@@ -945,6 +1024,7 @@ const Spacer(),
|
||||
queueItems: queueItems,
|
||||
groupedAlbums: groupedAlbums,
|
||||
albumCounts: historyStats.albumCounts,
|
||||
localLibraryItems: localLibraryItems,
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -982,7 +1062,8 @@ child: _buildSelectionBottomBar(
|
||||
required String historyViewMode,
|
||||
required List<DownloadItem> queueItems,
|
||||
required List<_GroupedAlbum> groupedAlbums,
|
||||
required Map<String, int> albumCounts,
|
||||
required Map<String, int> albumCounts,
|
||||
required List<LocalLibraryItem> localLibraryItems,
|
||||
}) {
|
||||
final historyItems = _resolveHistoryItems(
|
||||
filterMode: filterMode,
|
||||
@@ -1151,8 +1232,57 @@ if (filterMode == 'albums' && filteredGroupedAlbums.isNotEmpty)
|
||||
}, childCount: historyItems.length ),
|
||||
),
|
||||
|
||||
// Local Library Section
|
||||
if (localLibraryItems.isNotEmpty && filterMode == 'all')
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
context.l10n.libraryFilterLocal,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${localLibraryItems.length}',
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: colorScheme.onSecondaryContainer,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (localLibraryItems.isNotEmpty && filterMode == 'all')
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
final item = localLibraryItems[index];
|
||||
return KeyedSubtree(
|
||||
key: ValueKey('local_${item.id}'),
|
||||
child: _buildLocalLibraryItem(
|
||||
context,
|
||||
item,
|
||||
colorScheme,
|
||||
),
|
||||
);
|
||||
}, childCount: localLibraryItems.length),
|
||||
),
|
||||
|
||||
if (queueItems.isEmpty &&
|
||||
historyItems.isEmpty &&
|
||||
localLibraryItems.isEmpty &&
|
||||
(filterMode != 'albums' || filteredGroupedAlbums.isEmpty) &&
|
||||
!showFilteringIndicator)
|
||||
SliverFillRemaining(
|
||||
@@ -2084,6 +2214,27 @@ child: CachedNetworkImage(
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
// Source badge
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.primaryContainer,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
context.l10n.librarySourceDownloaded,
|
||||
style: Theme.of(context).textTheme.labelSmall
|
||||
?.copyWith(
|
||||
color: colorScheme.onPrimaryContainer,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
dateStr,
|
||||
style: Theme.of(context).textTheme.labelSmall
|
||||
@@ -2158,6 +2309,141 @@ child: CachedNetworkImage(
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLocalLibraryItem(
|
||||
BuildContext context,
|
||||
LocalLibraryItem item,
|
||||
ColorScheme colorScheme,
|
||||
) {
|
||||
final fileExists = _checkFileExists(item.filePath);
|
||||
|
||||
// Format quality info
|
||||
String? qualityStr;
|
||||
if (item.bitDepth != null && item.sampleRate != null) {
|
||||
qualityStr = '${item.bitDepth}bit/${(item.sampleRate! / 1000).toStringAsFixed(1)}kHz';
|
||||
}
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: InkWell(
|
||||
onTap: () => _openFile(item.filePath),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Row(
|
||||
children: [
|
||||
// Placeholder for cover (local library doesn't have cover URLs)
|
||||
Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.folder_outlined,
|
||||
color: colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
item.trackName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
item.artistName,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
// Source badge
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.secondaryContainer,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
context.l10n.librarySourceLocal,
|
||||
style: Theme.of(context).textTheme.labelSmall
|
||||
?.copyWith(
|
||||
color: colorScheme.onSecondaryContainer,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (qualityStr != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: qualityStr.startsWith('24')
|
||||
? colorScheme.tertiaryContainer
|
||||
: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
qualityStr,
|
||||
style: Theme.of(context).textTheme.labelSmall
|
||||
?.copyWith(
|
||||
color: qualityStr.startsWith('24')
|
||||
? colorScheme.onTertiaryContainer
|
||||
: colorScheme.onSurfaceVariant,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
if (fileExists)
|
||||
IconButton(
|
||||
onPressed: () => _openFile(item.filePath),
|
||||
icon: Icon(
|
||||
Icons.play_arrow,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
tooltip: context.l10n.tooltipPlay,
|
||||
)
|
||||
else
|
||||
Icon(
|
||||
Icons.error_outline,
|
||||
color: colorScheme.error,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _FilterChip extends StatelessWidget {
|
||||
|
||||
@@ -204,6 +204,21 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (settings.cloudProvider == 'webdav')
|
||||
SliverToBoxAdapter(
|
||||
child: SettingsGroup(
|
||||
children: [
|
||||
SettingsSwitchItem(
|
||||
icon: Icons.warning_amber_outlined,
|
||||
title: context.l10n.cloudSettingsAllowHttpTitle,
|
||||
subtitle: context.l10n.cloudSettingsAllowHttpSubtitle,
|
||||
value: settings.cloudAllowInsecureHttp,
|
||||
onChanged: _handleAllowHttpChanged,
|
||||
showDivider: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Test Connection Button
|
||||
SliverToBoxAdapter(
|
||||
@@ -347,11 +362,11 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
String _getProviderName(String provider) {
|
||||
switch (provider) {
|
||||
case 'webdav':
|
||||
return 'WebDAV (Synology, Nextcloud, QNAP)';
|
||||
return context.l10n.cloudProviderWebdav;
|
||||
case 'sftp':
|
||||
return 'SFTP (SSH File Transfer)';
|
||||
return context.l10n.cloudProviderSftp;
|
||||
default:
|
||||
return 'Not Configured';
|
||||
return context.l10n.cloudProviderNotConfigured;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,8 +403,8 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.web),
|
||||
title: const Text('WebDAV'),
|
||||
subtitle: const Text('Synology, Nextcloud, QNAP, ownCloud'),
|
||||
title: Text(context.l10n.cloudProviderWebdavTitle),
|
||||
subtitle: Text(context.l10n.cloudProviderWebdavSubtitle),
|
||||
trailing: current == 'webdav' ? Icon(Icons.check, color: colorScheme.primary) : null,
|
||||
onTap: () {
|
||||
ref.read(settingsProvider.notifier).setCloudProvider('webdav');
|
||||
@@ -398,8 +413,8 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.terminal),
|
||||
title: const Text('SFTP'),
|
||||
subtitle: const Text('SSH File Transfer Protocol'),
|
||||
title: Text(context.l10n.cloudProviderSftpTitle),
|
||||
subtitle: Text(context.l10n.cloudProviderSftpSubtitle),
|
||||
trailing: current == 'sftp' ? Icon(Icons.check, color: colorScheme.primary) : null,
|
||||
onTap: () {
|
||||
ref.read(settingsProvider.notifier).setCloudProvider('sftp');
|
||||
@@ -424,7 +439,7 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
if (settings.cloudServerUrl.isEmpty) {
|
||||
setState(() {
|
||||
_isTestingConnection = false;
|
||||
_connectionTestResult = 'Error: Server URL is required';
|
||||
_connectionTestResult = context.l10n.errorGeneric(context.l10n.cloudTestErrorServerUrlRequired);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -432,7 +447,7 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
if (settings.cloudUsername.isEmpty || settings.cloudPassword.isEmpty) {
|
||||
setState(() {
|
||||
_isTestingConnection = false;
|
||||
_connectionTestResult = 'Error: Username and password are required';
|
||||
_connectionTestResult = context.l10n.errorGeneric(context.l10n.cloudTestErrorCredentialsRequired);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -442,13 +457,14 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
serverUrl: settings.cloudServerUrl,
|
||||
username: settings.cloudUsername,
|
||||
password: settings.cloudPassword,
|
||||
allowInsecureHttp: settings.cloudAllowInsecureHttp,
|
||||
);
|
||||
|
||||
setState(() {
|
||||
_isTestingConnection = false;
|
||||
_connectionTestResult = result.success
|
||||
? 'Success: Connected to WebDAV server'
|
||||
: 'Error: ${result.error}';
|
||||
? context.l10n.connectionTestSuccess(context.l10n.cloudTestSuccessWebdav)
|
||||
: context.l10n.errorGeneric(_localizeWebDavError(context, result));
|
||||
});
|
||||
} else if (settings.cloudProvider == 'sftp') {
|
||||
final result = await CloudUploadService.instance.testSFTPConnection(
|
||||
@@ -460,17 +476,80 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
setState(() {
|
||||
_isTestingConnection = false;
|
||||
_connectionTestResult = result.success
|
||||
? 'Success: Connected to SFTP server'
|
||||
: 'Error: ${result.error}';
|
||||
? context.l10n.connectionTestSuccess(context.l10n.cloudTestSuccessSftp)
|
||||
: context.l10n.errorGeneric(result.error ?? '');
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_isTestingConnection = false;
|
||||
_connectionTestResult = 'Error: No provider selected';
|
||||
_connectionTestResult = context.l10n.errorGeneric(context.l10n.cloudTestErrorNoProvider);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleAllowHttpChanged(bool value) async {
|
||||
if (!value) {
|
||||
ref.read(settingsProvider.notifier).setCloudAllowInsecureHttp(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(context.l10n.cloudSettingsAllowHttpTitle),
|
||||
content: Text(context.l10n.cloudSettingsAllowHttpMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text(context.l10n.dialogCancel),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: Text(context.l10n.cloudSettingsAllowHttpConfirm),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
if (confirmed == true) {
|
||||
ref.read(settingsProvider.notifier).setCloudAllowInsecureHttp(true);
|
||||
}
|
||||
}
|
||||
|
||||
String _localizeWebDavError(
|
||||
BuildContext context,
|
||||
CloudUploadResult result,
|
||||
) {
|
||||
switch (result.errorCode) {
|
||||
case 'webdav_invalid_scheme':
|
||||
return context.l10n.webdavErrorInvalidScheme;
|
||||
case 'webdav_https_required':
|
||||
return context.l10n.webdavErrorHttpsRequired;
|
||||
case 'webdav_invalid_host':
|
||||
return context.l10n.webdavErrorInvalidHost;
|
||||
case 'webdav_auth_failed':
|
||||
return context.l10n.webdavErrorAuthFailed;
|
||||
case 'webdav_forbidden':
|
||||
return context.l10n.webdavErrorForbidden;
|
||||
case 'webdav_not_found':
|
||||
return context.l10n.webdavErrorNotFound;
|
||||
case 'webdav_connection_failed':
|
||||
return context.l10n.webdavErrorConnectionFailed;
|
||||
case 'webdav_tls_error':
|
||||
return context.l10n.webdavErrorTlsError;
|
||||
case 'webdav_timeout':
|
||||
return context.l10n.webdavErrorTimeout;
|
||||
case 'webdav_insufficient_storage':
|
||||
return context.l10n.webdavErrorInsufficientStorage;
|
||||
case 'webdav_unknown':
|
||||
return result.error ?? context.l10n.webdavErrorUnknown;
|
||||
default:
|
||||
return result.error ?? context.l10n.webdavErrorUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _resetSftpHostKey() async {
|
||||
final settings = ref.read(settingsProvider);
|
||||
if (settings.cloudServerUrl.isEmpty) {
|
||||
@@ -586,28 +665,28 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
context,
|
||||
Icons.hourglass_empty,
|
||||
uploadState.pendingCount.toString(),
|
||||
'Pending',
|
||||
context.l10n.uploadStatusPending,
|
||||
colorScheme.tertiary,
|
||||
),
|
||||
_buildStatItem(
|
||||
context,
|
||||
Icons.cloud_upload,
|
||||
uploadState.uploadingCount.toString(),
|
||||
'Uploading',
|
||||
context.l10n.uploadStatusUploading,
|
||||
colorScheme.primary,
|
||||
),
|
||||
_buildStatItem(
|
||||
context,
|
||||
Icons.check_circle,
|
||||
uploadState.completedCount.toString(),
|
||||
'Done',
|
||||
context.l10n.uploadStatusDone,
|
||||
Colors.green,
|
||||
),
|
||||
_buildStatItem(
|
||||
context,
|
||||
Icons.error,
|
||||
uploadState.failedCount.toString(),
|
||||
'Failed',
|
||||
context.l10n.uploadStatusFailed,
|
||||
colorScheme.error,
|
||||
),
|
||||
],
|
||||
@@ -729,7 +808,7 @@ class _CloudSettingsPageState extends ConsumerState<CloudSettingsPage> {
|
||||
onPressed: () {
|
||||
ref.read(uploadQueueProvider.notifier).retryFailed(item.id);
|
||||
},
|
||||
tooltip: 'Retry',
|
||||
tooltip: context.l10n.dialogRetry,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -410,9 +410,9 @@ class _LibraryStatusCard extends StatelessWidget {
|
||||
final now = DateTime.now();
|
||||
final diff = now.difference(lastScannedAt!);
|
||||
|
||||
if (diff.inMinutes < 1) return 'Just now';
|
||||
if (diff.inHours < 1) return '${diff.inMinutes} minutes ago';
|
||||
if (diff.inDays < 1) return '${diff.inHours} hours ago';
|
||||
if (diff.inMinutes < 1) return context.l10n.timeJustNow;
|
||||
if (diff.inHours < 1) return context.l10n.timeMinutesAgo(diff.inMinutes);
|
||||
if (diff.inDays < 1) return context.l10n.timeHoursAgo(diff.inHours);
|
||||
if (diff.inDays < 7) return context.l10n.dateDaysAgo(diff.inDays);
|
||||
|
||||
return '${lastScannedAt!.day}/${lastScannedAt!.month}/${lastScannedAt!.year}';
|
||||
|
||||
Reference in New Issue
Block a user