Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix(ui): remove duplicate empty state actions

Prediditc94c48304f6d
diff --git a/lib/pages/player/episode_comments_view.dart b/lib/pages/player/episode_comments_view.dart
index 1c259533..7c691369 100644
--- a/lib/pages/player/episode_comments_view.dart
+++ b/lib/pages/player/episode_comments_view.dart
@@ -5,7 +5,6 @@ import 'package:kazumi/bean/card/user_comments_card.dart';
import 'package:kazumi/bean/widget/error_widget.dart';
import 'package:kazumi/bean/widget/empty_state_widget.dart';
import 'package:kazumi/bean/widget/loading_indicator.dart';
-import 'package:kazumi/bean/widget/state_presentation.dart';
import 'package:kazumi/modules/bangumi/episode_item.dart';
import 'package:kazumi/modules/comments/comment_item.dart';
@@ -78,17 +77,10 @@ class EpisodeCommentsView extends StatelessWidget {
),
)
else if (!isLoading && comments.isEmpty)
- SliverToBoxAdapter(
+ const SliverToBoxAdapter(
child: GeneralEmptyState(
icon: Icons.chat_bubble_outline_rounded,
title: '本集还没有讨论',
- actions: [
- StateActionButton.tonal(
- onPressed: onSelectEpisode,
- icon: Icons.video_library_outlined,
- text: '切换分集',
- ),
- ],
),
)
else if (comments.isNotEmpty) ...[
diff --git a/lib/pages/plugin_editor/plugin_view_page.dart b/lib/pages/plugin_editor/plugin_view_page.dart
index 6795ba3f..1558e574 100644
--- a/lib/pages/plugin_editor/plugin_view_page.dart
+++ b/lib/pages/plugin_editor/plugin_view_page.dart
@@ -343,33 +343,27 @@ class _PluginViewPageState extends State<PluginViewPage> {
const SizedBox(height: 8),
],
),
- footer: visible.isEmpty
- ? GeneralEmptyState(
- icon: all.isEmpty
- ? Icons.extension_rounded
- : Icons.search_off_rounded,
- title: all.isEmpty
- ? '还没有安装规则'
- : _updatesOnly && query.isEmpty
+ footer: all.isEmpty
+ ? const GeneralEmptyState(
+ icon: Icons.extension_rounded,
+ title: '还没有安装规则',
+ )
+ : visible.isEmpty
+ ? GeneralEmptyState(
+ icon: Icons.search_off_rounded,
+ title: _updatesOnly && query.isEmpty
? '没有可更新的规则'
: '没有符合条件的规则',
- actions: [
- if (all.isEmpty)
- StateActionButton.tonal(
- onPressed: () => context
- .pushNamed('/settings/plugin/shop'),
- icon: Icons.travel_explore_rounded,
- text: '浏览规则仓库')
- else
- StateActionButton.tonal(
- onPressed: () => setState(() {
- _search.clear();
- _updatesOnly = false;
- }),
- text: '显示全部规则'),
- ],
- )
- : null,
+ actions: [
+ StateActionButton.tonal(
+ onPressed: () => setState(() {
+ _search.clear();
+ _updatesOnly = false;
+ }),
+ text: '显示全部规则'),
+ ],
+ )
+ : null,
itemCount: visible.length,
itemBuilder: (context, index) {
final plugin = visible[index];
diff --git a/lib/pages/search/image_search_widgets.dart b/lib/pages/search/image_search_widgets.dart
index bbac76ea..3bd6eeae 100644
--- a/lib/pages/search/image_search_widgets.dart
+++ b/lib/pages/search/image_search_widgets.dart
@@ -128,8 +128,6 @@ class _ImageSearchResults extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colors = Theme.of(context).colorScheme;
- final type = Theme.of(context).textTheme;
if (searching) {
return const _ImageSearchLoadingState();
}
@@ -143,19 +141,13 @@ class _ImageSearchResults extends StatelessWidget {
retryText: '重新识别',
);
}
- return GeneralEmptyState(
+ return const GeneralEmptyState(
icon: Icons.image_search_rounded,
title: '没有找到匹配画面',
- actions: [
- if (onRetry != null)
- StateActionButton.tonal(
- onPressed: onRetry!,
- icon: Icons.refresh_rounded,
- text: '重新识别',
- ),
- ],
);
}
+ final colors = Theme.of(context).colorScheme;
+ final type = Theme.of(context).textTheme;
return Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
Semantics(
header: true,
diff --git a/lib/pages/search/search_page.dart b/lib/pages/search/search_page.dart
index 155395ed..526512c3 100644
--- a/lib/pages/search/search_page.dart
+++ b/lib/pages/search/search_page.dart
@@ -309,26 +309,27 @@ class _SearchPageState extends State<SearchPage> {
)),
if (busy && allItems.isEmpty)
const SliverToBoxAdapter(child: _SearchLoadingState())
+ else if (allItems.isEmpty)
+ const SliverToBoxAdapter(
+ child: GeneralEmptyState(
+ icon: Icons.search_off_rounded,
+ title: '没有找到番剧',
+ ),
+ )
else if (items.isEmpty)
SliverToBoxAdapter(
child: GeneralEmptyState(
- icon: allItems.isEmpty
- ? Icons.search_off_rounded
- : Icons.filter_alt_off_rounded,
- title: allItems.isEmpty ? '没有找到番剧' : '这些番剧被筛选隐藏了',
+ icon: Icons.filter_alt_off_rounded,
+ title: '这些番剧被筛选隐藏了',
actions: [
StateActionButton.tonal(
- onPressed: allItems.isEmpty
- ? () => _submit(_submittedQuery!)
- : () async {
- await _controller.setNotShowWatchedBangumis(false);
- await _controller.setNotShowAbandonedBangumis(false);
- },
- icon: allItems.isEmpty
- ? Icons.refresh_rounded
- : Icons.visibility_outlined,
- text: allItems.isEmpty ? '重新搜索' : '显示全部'),
- TextButton(onPressed: _showFilters, child: const Text('调整筛选')),
+ onPressed: () async {
+ await _controller.setNotShowWatchedBangumis(false);
+ await _controller.setNotShowAbandonedBangumis(false);
+ },
+ icon: Icons.visibility_outlined,
+ text: '显示全部',
+ ),
],
))
else