feat(flutter): 新增剧场筛选页
This commit is contained in:
1 parent
85ba2a4fec
commit
850f8e7c8c
12 files changed
+1012
-52
No files matched your search
@@ -16,6 +16,7 @@ import '../../core/theme/app_theme.dart';
|
||||
import '../../core/widgets/app_bottom_nav.dart';
|
||||
import '../../core/widgets/empty_state.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../filter/filter_page.dart';
|
||||
import '../new_releases/new_releases_page.dart';
|
||||
import '../player/open_player.dart';
|
||||
import '../ranking/ranking_page.dart';
|
||||
@@ -261,7 +262,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
? categories.feed.dramas
|
||||
: categories.dramasOf(logic.selectedCategoryId!);
|
||||
return [
|
||||
_toolbar(l10n, categories),
|
||||
_toolbar(l10n),
|
||||
if (dramas.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 40),
|
||||
@@ -350,7 +351,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _toolbar(AppLocalizations l10n, CategoryController categories) {
|
||||
Widget _toolbar(AppLocalizations l10n) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(14, 2, 14, 12),
|
||||
child: Row(
|
||||
@@ -361,7 +362,7 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
icon: Icons.tune_rounded,
|
||||
color: _filterIconColor,
|
||||
label: l10n.filter,
|
||||
onTap: () => _openFilterSheet(l10n, categories),
|
||||
onTap: () => _openPage(context, const FilterPage()),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: _toolbarGap),
|
||||
@@ -443,43 +444,6 @@ class _DiscoverPageState extends State<DiscoverPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _openFilterSheet(
|
||||
AppLocalizations l10n,
|
||||
CategoryController categories,
|
||||
) async {
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: AppColors.card,
|
||||
showDragHandle: true,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: ListView(
|
||||
key: const Key('theater-filter-sheet'),
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
children: [
|
||||
ListTile(
|
||||
key: const Key('theater-filter-option-all'),
|
||||
title: Text(l10n.all),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
logic.selectCategory(null);
|
||||
},
|
||||
),
|
||||
for (final category in categories.categories)
|
||||
ListTile(
|
||||
key: Key('theater-filter-option-${category.id}'),
|
||||
title: Text(category.name),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
logic.selectCategory(category.id);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openPage(BuildContext context, Widget page) {
|
||||
Navigator.of(context).push<void>(MaterialPageRoute(builder: (_) => page));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user