Skip to content

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

fix(collect): sync selected category and remove tab splash overlay

Predidit5f9b3137775c
diff --git a/lib/pages/collect/collect_library_controls.dart b/lib/pages/collect/collect_library_controls.dart
index 787f0711..1ea90b3b 100644
--- a/lib/pages/collect/collect_library_controls.dart
+++ b/lib/pages/collect/collect_library_controls.dart
@@ -38,7 +38,8 @@ class _CollectCategories extends StatelessWidget {
labelStyle: labelStyle,
unselectedLabelStyle: labelStyle,
labelPadding: const EdgeInsets.symmetric(horizontal: 2),
- splashBorderRadius: BorderRadius.circular(24),
+ splashFactory: NoSplash.splashFactory,
+ overlayColor: const WidgetStatePropertyAll(Colors.transparent),
tabs: [
for (final type in _collectCategories)
Tab(
diff --git a/lib/pages/collect/collect_library_view.dart b/lib/pages/collect/collect_library_view.dart
index b2af9dc8..25b5b644 100644
--- a/lib/pages/collect/collect_library_view.dart
+++ b/lib/pages/collect/collect_library_view.dart
@@ -63,8 +63,8 @@ class _CollectLibraryViewState extends State<CollectLibraryView>
String _query = '';
bool _searchExpanded = false;
- // TabController also notifies when an animation ends; this only notifies on
- // real category changes, and tab switches rebuild nothing but its listeners.
+ // The tapped tab while a tap animates, otherwise the dominant page so swipes
+ // update mid-gesture. Tab switches rebuild nothing but its listeners.
final _selectedType = ValueNotifier<CollectType?>(CollectType.watching);
@override
@@ -87,11 +87,19 @@ class _CollectLibraryViewState extends State<CollectLibraryView>
initialIndex: _collectCategories.indexOf(_selectedType.value),
animationDuration: disableAnimations ? Duration.zero : null,
vsync: this,
- )..addListener(_syncSelectedType);
+ )
+ ..addListener(_syncSelectedType)
+ ..animation!.addListener(_syncSelectedType);
}
- void _syncSelectedType() =>
- _selectedType.value = _collectCategories[_tabController.index];
+ void _syncSelectedType() {
+ final index = _tabController.indexIsChanging
+ ? _tabController.index
+ : _tabController.animation!.value
+ .round()
+ .clamp(0, _collectCategories.length - 1);
+ _selectedType.value = _collectCategories[index];
+ }
@override
void didUpdateWidget(covariant CollectLibraryView oldWidget) {