feat(flutter): 接入分类记录收藏与下载授权

This commit is contained in:
Zhou Weidong committed 2026-10-17 14:49:16 +08:00
1 parent 00280ca0da
commit cc4d7c5a9d
52 files changed
+4440 -171

No files matched your search

+6 -43
View File
@@ -19,7 +19,6 @@ class DiscoverLogic extends ChangeNotifier {
final TextEditingController search = TextEditingController();
final FocusNode searchFocus = FocusNode();
final ScrollController scroll = ScrollController();
int category = 0;
bool searchOpen = false;
bool _disposed = false;
@@ -35,11 +34,6 @@ class DiscoverLogic extends ChangeNotifier {
.catchError((Object _) => null);
}
void selectCategory(int index) {
category = index;
notify();
}
void onSearchChanged() => notify();
bool get showSearch => searchOpen || search.text.isNotEmpty;
@@ -105,7 +99,12 @@ class DiscoverLogic extends ChangeNotifier {
} else if (embedded && onDramaSelected != null) {
onDramaSelected(selected);
} else {
act(context, DiscoverPageAction.detail, embedded: embedded, onAction: onAction);
act(
context,
DiscoverPageAction.detail,
embedded: embedded,
onAction: onAction,
);
}
}
@@ -123,42 +122,6 @@ class DiscoverLogic extends ChangeNotifier {
).showSnackBar(SnackBar(content: Text(l10n.demoCatalogNotice)));
}
void showFilters(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
final labels = [
l10n.forYou,
l10n.hot,
l10n.newest,
l10n.romance,
l10n.actionGenre,
];
showModalBottomSheet<void>(
context: context,
backgroundColor: const Color(0xFF202126),
showDragHandle: true,
builder: (sheetContext) => SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(title: Text(l10n.filter)),
for (var index = 0; index < labels.length; index++)
ListTile(
title: Text(labels[index]),
trailing: index == category
? const Icon(Icons.check_rounded, color: Color(0xFF2F7BFF))
: null,
onTap: () {
selectCategory(index);
Navigator.pop(sheetContext);
},
),
const SizedBox(height: 8),
],
),
),
);
}
@override
void dispose() {
_disposed = true;