mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
Small improvements
This commit is contained in:
parent
86ff355e21
commit
b17a74bb23
10 changed files with 81 additions and 20 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
|
|
@ -91,7 +92,7 @@ class HomeScreen extends ConsumerWidget {
|
|||
action: () => e.navigate(context),
|
||||
);
|
||||
case HomeTabs.sync:
|
||||
if (canDownload) {
|
||||
if (canDownload && !kIsWeb) {
|
||||
return DestinationModel(
|
||||
label: context.localized.navigationSync,
|
||||
icon: Icon(e.icon),
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class SeasonPoster extends ConsumerWidget {
|
|||
items: season.generateActions(context, ref).popupMenuItems(useIcons: true));
|
||||
},
|
||||
onTap: () => onSeasonPressed?.call(season),
|
||||
onLongPress: AdaptiveLayout.of(context).inputDevice != InputDevice.touch
|
||||
onLongPress: AdaptiveLayout.of(context).inputDevice == InputDevice.touch
|
||||
? () {
|
||||
showBottomSheetPill(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
|
||||
import 'package:fladder/models/syncing/sync_item.dart';
|
||||
import 'package:fladder/providers/sync/background_download_provider.dart';
|
||||
import 'package:fladder/providers/sync/sync_provider_helpers.dart';
|
||||
import 'package:fladder/providers/sync_provider.dart';
|
||||
import 'package:fladder/util/localization_helper.dart';
|
||||
|
|
@ -33,7 +34,23 @@ class SyncOptionsButton extends ConsumerWidget {
|
|||
|
||||
final syncedChildren =
|
||||
children.where((element) => element.hasVideoFile && element.videoFile.existsSync()).toList();
|
||||
return [
|
||||
|
||||
final syncTasks = children
|
||||
.map((element) {
|
||||
final task = ref.read(syncDownloadStatusProvider(element, []));
|
||||
if (task?.status != TaskStatus.notFound) {
|
||||
return task;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.nonNulls
|
||||
.toList();
|
||||
|
||||
final runningTasks = syncTasks.where((element) => element.status == TaskStatus.running).toList();
|
||||
final enqueuedTasks = syncTasks.where((element) => element.status == TaskStatus.enqueued).toList();
|
||||
final pausedTasks = syncTasks.where((element) => element.status == TaskStatus.paused).toList();
|
||||
return <PopupMenuEntry>[
|
||||
PopupMenuItem(
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
|
|
@ -45,13 +62,14 @@ class SyncOptionsButton extends ConsumerWidget {
|
|||
onTap: () => context.refreshData(),
|
||||
),
|
||||
if (children.isNotEmpty) ...[
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
enabled: unSyncedChildren.isNotEmpty,
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
const Icon(IconsaxPlusLinear.cloud_add),
|
||||
Text(context.localized.sync),
|
||||
Text(context.localized.syncAllFiles),
|
||||
],
|
||||
),
|
||||
onTap: () async => _syncRemainingItems(context, syncedItem, unSyncedChildren, ref),
|
||||
|
|
@ -62,11 +80,54 @@ class SyncOptionsButton extends ConsumerWidget {
|
|||
spacing: 12,
|
||||
children: [
|
||||
const Icon(IconsaxPlusLinear.trash),
|
||||
Text(context.localized.delete),
|
||||
Text(context.localized.syncDeleteAll),
|
||||
],
|
||||
),
|
||||
onTap: () async => _deleteSyncedItems(context, syncedItem, syncedChildren, ref),
|
||||
)
|
||||
),
|
||||
const PopupMenuDivider(),
|
||||
PopupMenuItem(
|
||||
enabled: pausedTasks.isNotEmpty,
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
const Icon(IconsaxPlusLinear.play),
|
||||
Text(context.localized.syncResumeAll),
|
||||
],
|
||||
),
|
||||
onTap: () => ref
|
||||
.read(backgroundDownloaderProvider)
|
||||
.resumeAll(tasks: pausedTasks.map((e) => e.task).nonNulls.toList()),
|
||||
),
|
||||
PopupMenuItem(
|
||||
enabled: runningTasks.isNotEmpty,
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
const Icon(IconsaxPlusLinear.pause),
|
||||
Text(context.localized.syncPauseAll),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
ref
|
||||
.read(backgroundDownloaderProvider)
|
||||
.pauseAll(tasks: runningTasks.map((e) => e.task).nonNulls.toList());
|
||||
},
|
||||
),
|
||||
PopupMenuItem(
|
||||
enabled: [...runningTasks, ...pausedTasks, ...enqueuedTasks].isNotEmpty,
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
const Icon(IconsaxPlusLinear.stop),
|
||||
Text(context.localized.syncStopAll),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
ref.read(backgroundDownloaderProvider).cancelAll(
|
||||
tasks: [...runningTasks, ...pausedTasks, ...enqueuedTasks].map((e) => e.task).nonNulls.toList());
|
||||
},
|
||||
),
|
||||
]
|
||||
];
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue