feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
This commit was merged in pull request #13.
This commit is contained in:
1 parent
aa5255d1e4
commit
abc1868550
260 files changed
+43964
-5591
No files matched your search
@@ -2,11 +2,12 @@ import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:cutdex_ui/icons.dart';
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
|
||||
import '../../integrations/runtime/processing_resource_repository.dart';
|
||||
import '../../workspace/background_task_registry.dart';
|
||||
import '../../workspace/background_task_state.dart';
|
||||
import '../../shared/widgets/listenable_selector.dart';
|
||||
import '../../integrations/runtime/processing_resource_state.dart';
|
||||
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
@@ -14,9 +15,14 @@ import 'package:cutdex_ui/widgets.dart';
|
||||
import '../media/background_tasks_dialog.dart';
|
||||
|
||||
class BackgroundTasksButton extends ConsumerWidget {
|
||||
const BackgroundTasksButton({super.key, this.iconSize = AppIconSize.header});
|
||||
const BackgroundTasksButton({
|
||||
super.key,
|
||||
this.iconSize = AppIconSize.header,
|
||||
this.alignment = AlignmentDirectional.bottomStart,
|
||||
});
|
||||
|
||||
final double iconSize;
|
||||
final AlignmentGeometry alignment;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -25,30 +31,39 @@ class BackgroundTasksButton extends ConsumerWidget {
|
||||
.watch(processingResourceRepositoryProvider)
|
||||
.asData
|
||||
?.value;
|
||||
final tasks = ref.watch(backgroundTasksProvider(registry: registry));
|
||||
final downloads = resources == null
|
||||
? null
|
||||
: ref.watch(processingResourcesProvider(resources));
|
||||
bool hasRunningTasks() =>
|
||||
tasks.runningCount > 0 ||
|
||||
downloads?.subtitleDownloading == true ||
|
||||
(downloads?.installs.any(
|
||||
(install) => install.state == ProcessingResourceState.downloading,
|
||||
) ??
|
||||
false);
|
||||
Widget button(VoidCallback toggle) => IconButton(
|
||||
: ref.watch(
|
||||
processingResourcesProvider(resources).select(
|
||||
(downloads) =>
|
||||
downloads.subtitleDownloading ||
|
||||
downloads.installs.any(
|
||||
(install) =>
|
||||
install.state == ProcessingResourceState.downloading,
|
||||
),
|
||||
),
|
||||
);
|
||||
Widget button(VoidCallback toggle, bool running) => IconButton(
|
||||
key: const ValueKey('background-tasks-button'),
|
||||
tooltip: context.l10n.backgroundTasks,
|
||||
onPressed: toggle,
|
||||
icon: Badge(
|
||||
isLabelVisible: hasRunningTasks(),
|
||||
child: Icon(Icons.task_alt_outlined, size: iconSize),
|
||||
isLabelVisible: running || downloads == true,
|
||||
child: Icon(AppIcons.success, size: iconSize),
|
||||
),
|
||||
);
|
||||
return AppPopover(
|
||||
width: 384,
|
||||
builder: (_, toggle) => button(toggle),
|
||||
child: BackgroundTasksContent(registry: registry, repository: resources),
|
||||
return ListenableSelector<bool>(
|
||||
listenable: registry,
|
||||
select: () => registry.runningCount > 0,
|
||||
builder: (context, running) => AppPopover(
|
||||
width: 384,
|
||||
alignment: alignment,
|
||||
builder: (_, toggle) => button(toggle, running),
|
||||
child: BackgroundTasksContent(
|
||||
registry: registry,
|
||||
repository: resources,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user