mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-01 00:10:16 +08:00
opt scrollable gesture
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:PiliPlus/models_new/video/video_ai_conclusion/model_result.dart'
|
||||
import 'package:PiliPlus/pages/common/slide/common_slide_page.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -166,30 +165,21 @@ class _AiDetailState extends State<AiConclusionPanel>
|
||||
}
|
||||
|
||||
late Key _key;
|
||||
late bool _isNested;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final controller = PrimaryScrollController.of(context);
|
||||
_isNested = controller is ExtendedNestedScrollController;
|
||||
_key = ValueKey(controller.hashCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme) {
|
||||
final child = AiConclusionPanel.buildContent(
|
||||
return AiConclusionPanel.buildContent(
|
||||
context,
|
||||
theme,
|
||||
widget.item,
|
||||
key: _key,
|
||||
);
|
||||
if (_isNested) {
|
||||
return ExtendedVisibilityDetector(
|
||||
uniqueKey: const Key('ai-conclusion'),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/flutter/page/tabs.dart';
|
||||
import 'package:PiliPlus/common/widgets/keep_alive_wrapper.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart'
|
||||
show tabBarScrollPhysics;
|
||||
import 'package:PiliPlus/common/widgets/selection_text.dart';
|
||||
import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
||||
import 'package:PiliPlus/models/common/stat_type.dart';
|
||||
@@ -11,7 +11,7 @@ import 'package:PiliPlus/pages/pgc_review/view.dart';
|
||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||
import 'package:PiliPlus/utils/extension/scroll_controller_ext.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart' hide TabBarView;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class PgcIntroPanel extends CommonSlidePage {
|
||||
@@ -94,9 +94,9 @@ class _IntroDetailState extends State<PgcIntroPanel>
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme) {
|
||||
return TabBarView<TabBarDragGestureRecognizer>(
|
||||
return TabBarView(
|
||||
controller: _tabController,
|
||||
physics: clampingScrollPhysics,
|
||||
physics: tabBarScrollPhysics,
|
||||
horizontalDragGestureRecognizer: () =>
|
||||
TabBarDragGestureRecognizer(isDxAllowed: isDxAllowed),
|
||||
children: [
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart' show ReloadMixin;
|
||||
import 'package:PiliPlus/http/api.dart';
|
||||
import 'package:PiliPlus/http/constants.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
|
||||
@@ -11,7 +11,6 @@ import 'package:PiliPlus/pages/webview/view.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/bili_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -94,43 +93,36 @@ class _NoteListPageState extends State<NoteListPage>
|
||||
}
|
||||
|
||||
late Key _key;
|
||||
late bool _isNested;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final controller = PrimaryScrollController.of(context);
|
||||
_isNested = controller is ExtendedNestedScrollController;
|
||||
_key = ValueKey(controller.hashCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme) {
|
||||
Widget child = refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
key: _key,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.only(bottom: 100),
|
||||
sliver: Obx(
|
||||
() => _buildBody(theme, _controller.loadingState.value),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (_isNested) {
|
||||
child = ExtendedVisibilityDetector(
|
||||
uniqueKey: const ValueKey(NoteListPage),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(child: child),
|
||||
Expanded(
|
||||
child: refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
key: _key,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
padding: const .only(bottom: 100),
|
||||
sliver: Obx(
|
||||
() => _buildBody(theme, _controller.loadingState.value),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 12,
|
||||
|
||||
@@ -3,7 +3,8 @@ import 'dart:math' as math;
|
||||
import 'dart:math' show max;
|
||||
|
||||
import 'package:PiliPlus/common/assets.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart'
|
||||
show tabBarScrollPhysics;
|
||||
import 'package:PiliPlus/pages/common/publish/publish_route.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/size_ext.dart';
|
||||
@@ -303,7 +304,7 @@ class _PayCoinsPageState extends State<PayCoinsPage>
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
child: PageView(
|
||||
physics: clampingScrollPhysics,
|
||||
physics: tabBarScrollPhysics,
|
||||
controller: _controller,
|
||||
onPageChanged: (index) {
|
||||
_scale();
|
||||
|
||||
@@ -14,7 +14,6 @@ import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/post_panel/popup_menu_text.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart' show FilteringTextInputFormatter;
|
||||
@@ -235,13 +234,11 @@ class _PostPanelState extends State<PostPanel>
|
||||
}
|
||||
|
||||
late Key _key;
|
||||
late bool _isNested;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final controller = PrimaryScrollController.of(context);
|
||||
_isNested = controller is ExtendedNestedScrollController;
|
||||
_key = ValueKey(controller.hashCode);
|
||||
}
|
||||
|
||||
@@ -251,25 +248,18 @@ class _PostPanelState extends State<PostPanel>
|
||||
return scrollableError;
|
||||
}
|
||||
final bottom = MediaQuery.viewPaddingOf(context).bottom;
|
||||
Widget child = ListView.builder(
|
||||
key: _key,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(bottom: 88 + bottom),
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildItem(theme, index, list[index]);
|
||||
},
|
||||
);
|
||||
if (_isNested) {
|
||||
child = ExtendedVisibilityDetector(
|
||||
uniqueKey: const ValueKey(PostPanel),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
child,
|
||||
ListView.builder(
|
||||
key: _key,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(bottom: 88 + bottom),
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildItem(theme, index, list[index]);
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
right: kFloatingActionButtonMargin,
|
||||
bottom: kFloatingActionButtonMargin + bottom,
|
||||
|
||||
@@ -13,7 +13,6 @@ import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_reply/view.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -68,7 +67,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final child = fabAnimWrapper(
|
||||
return fabAnimWrapper(
|
||||
child: refreshIndicator(
|
||||
onRefresh: _videoReplyController.onRefresh,
|
||||
isClampingScrollPhysics: widget.isNested,
|
||||
@@ -149,13 +148,6 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
),
|
||||
),
|
||||
);
|
||||
if (widget.isNested) {
|
||||
return ExtendedVisibilityDetector(
|
||||
uniqueKey: const ValueKey(VideoReplyPanel),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
Widget _buildBody(LoadingState<List<ReplyInfo>?> loadingState) {
|
||||
|
||||
@@ -183,7 +183,7 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme) {
|
||||
final child = refreshIndicator(
|
||||
return refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
isClampingScrollPhysics: widget.isNested,
|
||||
child: CustomScrollView(
|
||||
@@ -211,10 +211,6 @@ class _VideoReplyReplyPanelState extends State<VideoReplyReplyPanel>
|
||||
],
|
||||
),
|
||||
);
|
||||
if (widget.isNested) {
|
||||
return ExtendedVisibilityDetector(uniqueKey: Key(_tag), child: child);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
Widget _header(ThemeData theme, ReplyInfo firstFloor) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart' show tabBarView;
|
||||
import 'package:PiliPlus/common/widgets/view_safe_area.dart';
|
||||
import 'package:PiliPlus/models/common/reply/reply_search_type.dart';
|
||||
import 'package:PiliPlus/pages/video/reply_search_item/child/view.dart';
|
||||
|
||||
@@ -587,13 +587,10 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
buildTabBar(onTap: videoDetailController.animToTop),
|
||||
Expanded(
|
||||
child: tabBarView(
|
||||
hitTestBehavior: .translucent,
|
||||
controller: videoDetailController.tabCtr,
|
||||
children: [
|
||||
videoIntro(
|
||||
isHorizontal: false,
|
||||
needCtr: false,
|
||||
isNested: true,
|
||||
),
|
||||
videoIntro(isHorizontal: false, needCtr: false),
|
||||
if (videoDetailController.showReply)
|
||||
videoReplyPanel(isNested: true),
|
||||
if (_shouldShowSeasonPanel) seasonPanel,
|
||||
@@ -1648,7 +1645,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
bool? isHorizontal,
|
||||
bool needRelated = true,
|
||||
bool needCtr = true,
|
||||
bool isNested = false,
|
||||
}) {
|
||||
if (videoDetailController.isFileSource) {
|
||||
return localIntroPanel(needCtr: needCtr);
|
||||
@@ -1708,12 +1704,6 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
|
||||
),
|
||||
],
|
||||
);
|
||||
if (isNested) {
|
||||
child = ExtendedVisibilityDetector(
|
||||
uniqueKey: const Key('intro-panel'),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return KeepAliveWrapper(child: child);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/pages/common/slide/common_slide_page.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/utils/duration_utils.dart';
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -78,19 +77,17 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
}
|
||||
|
||||
late Key _key;
|
||||
late bool _isNested;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final controller = PrimaryScrollController.of(context);
|
||||
_isNested = controller is ExtendedNestedScrollController;
|
||||
_key = ValueKey(controller.hashCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget buildList(ThemeData theme) {
|
||||
final child = ListView.builder(
|
||||
return ListView.builder(
|
||||
key: _key,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: EdgeInsets.only(
|
||||
@@ -112,13 +109,6 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
return _buildItem(theme.colorScheme, segment, isCurr);
|
||||
},
|
||||
);
|
||||
if (_isNested) {
|
||||
return ExtendedVisibilityDetector(
|
||||
uniqueKey: const ValueKey(ViewPointsPage),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
Widget _buildItem(
|
||||
|
||||
Reference in New Issue
Block a user