first commit
Build / Build for Android (push) Has been cancelled
Build / Build for iOS (push) Has been cancelled

This commit is contained in:
Zakaria
2026-05-18 14:15:38 -04:00
commit 1563409cb1
382 changed files with 45347 additions and 0 deletions
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:get_it/get_it.dart';
import '../../services/downloads_helper.dart';
import '../error_snackbar.dart';
import 'download_error_list_tile.dart';
class DownloadErrorList extends StatefulWidget {
const DownloadErrorList({Key? key}) : super(key: key);
@override
State<DownloadErrorList> createState() => _DownloadErrorListState();
}
class _DownloadErrorListState extends State<DownloadErrorList> {
List<DownloadTask>? loadedDownloadTasks;
late Future<List<DownloadTask>?> downloadErrorListFuture;
DownloadsHelper downloadsHelper = GetIt.instance<DownloadsHelper>();
@override
void initState() {
super.initState();
downloadErrorListFuture =
downloadsHelper.getDownloadsWithStatus(DownloadTaskStatus.failed);
}
@override
Widget build(BuildContext context) {
return FutureBuilder<List<DownloadTask>?>(
future: downloadErrorListFuture,
builder: (context, snapshot) {
loadedDownloadTasks = snapshot.data;
if (snapshot.hasData) {
if (snapshot.data!.isEmpty) {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.check,
size: 64,
// Inactive icons have an opacity of 50% with dark theme and 38%
// with bright theme
// https://material.io/design/iconography/system-icons.html#color
color: Theme.of(context).iconTheme.color?.withOpacity(
Theme.of(context).brightness == Brightness.light
? 0.38
: 0.5)),
const Padding(padding: EdgeInsets.all(8.0)),
Text(AppLocalizations.of(context)!.noErrors),
],
),
);
} else {
return ListView.builder(
itemCount: snapshot.data!.length,
itemBuilder: (context, index) {
return DownloadErrorListTile(
downloadTask: snapshot.data![index]);
},
);
}
} else if (snapshot.hasError) {
errorSnackbar(snapshot.error, context);
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(AppLocalizations.of(context)!.errorScreenError),
),
);
} else {
return const Center(
child: CircularProgressIndicator.adaptive(),
);
}
},
);
}
}
@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:get_it/get_it.dart';
import '../../models/finamp_models.dart';
import '../../services/downloads_helper.dart';
import '../../services/process_artist.dart';
import '../album_image.dart';
class DownloadErrorListTile extends StatelessWidget {
const DownloadErrorListTile({Key? key, required this.downloadTask})
: super(key: key);
final DownloadTask downloadTask;
@override
Widget build(BuildContext context) {
DownloadsHelper downloadsHelper = GetIt.instance<DownloadsHelper>();
DownloadedSong? downloadedSong =
downloadsHelper.getJellyfinItemFromDownloadId(downloadTask.taskId);
if (downloadedSong == null) {
return ListTile(
title: Text(downloadTask.taskId),
subtitle:
Text(AppLocalizations.of(context)!.failedToGetSongFromDownloadId),
);
}
return ListTile(
leading: AlbumImage(item: downloadedSong.song),
title: Text(downloadedSong.song.name == null
? AppLocalizations.of(context)!.unknownName
: downloadedSong.song.name!),
subtitle: Text(processArtist(downloadedSong.song.albumArtist, context)),
// trailing: IconButton(
// icon: Icon(Icons.refresh),
// onPressed: () {},
// tooltip: "Retry",
// ),
);
}
}