feat(app): 搜索改为调用后端并渲染卡片结果
This commit is contained in:
1 parent
730e38622f
commit
ade0cc3566
13 files changed
+424
-20
No files matched your search
@@ -8,6 +8,9 @@ class _HomeDramaGrid extends StatelessWidget {
|
||||
required this.categories,
|
||||
required this.dramas,
|
||||
required this.searching,
|
||||
required this.searchLoading,
|
||||
required this.searchError,
|
||||
required this.onRetrySearch,
|
||||
required this.onOpen,
|
||||
});
|
||||
|
||||
@@ -15,6 +18,9 @@ class _HomeDramaGrid extends StatelessWidget {
|
||||
final CategoryController categories;
|
||||
final List<Drama> dramas;
|
||||
final bool searching;
|
||||
final bool searchLoading;
|
||||
final String? searchError;
|
||||
final VoidCallback onRetrySearch;
|
||||
final ValueChanged<Drama> onOpen;
|
||||
|
||||
@override
|
||||
@@ -37,6 +43,29 @@ class _HomeDramaGrid extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
if (searching && searchLoading) {
|
||||
return const SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
key: Key('discover-search-loading'),
|
||||
strokeWidth: 2,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (searching && searchError != null) {
|
||||
return _fill(
|
||||
EmptyState(
|
||||
key: const Key('discover-search-error'),
|
||||
icon: Icons.cloud_off_rounded,
|
||||
title: errorText(l10n, searchError, l10n.searchFailed),
|
||||
actionLabel: l10n.retry,
|
||||
actionKey: const Key('discover-search-retry'),
|
||||
onAction: onRetrySearch,
|
||||
),
|
||||
);
|
||||
}
|
||||
if (dramas.isEmpty) {
|
||||
return _fill(
|
||||
EmptyState(
|
||||
|
||||
Reference in new issue
Block a user