opt gesture

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-23 11:46:16 +08:00
parent 310f497c30
commit bd158619a4
17 changed files with 407 additions and 396 deletions

View File

@@ -21,7 +21,7 @@ class PgcIntroPanel extends CommonSlidePage {
const PgcIntroPanel({
super.key,
required this.item,
super.enableSlide = false,
super.enableSlide,
this.videoTags,
});
@@ -50,42 +50,61 @@ class _IntroDetailState extends State<PgcIntroPanel>
@override
Widget buildPage(ThemeData theme) {
return CustomTabBarView(
controller: _tabController,
physics: const CustomTabBarViewScrollPhysics(),
bgColor: theme.colorScheme.surface,
header: Row(
return Material(
color: theme.colorScheme.surface,
child: Column(
children: [
Row(
children: [
Expanded(
child: TabBar(
controller: _tabController,
dividerHeight: 0,
isScrollable: true,
tabAlignment: TabAlignment.start,
dividerColor: Colors.transparent,
tabs: const [
Tab(text: '详情'),
Tab(text: '点评'),
],
onTap: (index) {
if (!_tabController.indexIsChanging) {
if (index == 0) {
_controller.animToTop();
}
}
},
),
),
IconButton(
tooltip: '关闭',
icon: const Icon(Icons.close, size: 20),
onPressed: Get.back,
),
const SizedBox(width: 2),
],
),
Expanded(
child: TabBar(
controller: _tabController,
dividerHeight: 0,
isScrollable: true,
tabAlignment: TabAlignment.start,
dividerColor: Colors.transparent,
tabs: const [
Tab(text: '详情'),
Tab(text: '点评'),
],
onTap: (index) {
if (!_tabController.indexIsChanging) {
if (index == 0) {
_controller.animToTop();
}
}
},
),
child: enableSlide ? slideList(theme) : buildList(theme),
),
IconButton(
tooltip: '关闭',
icon: const Icon(Icons.close, size: 20),
onPressed: Get.back,
),
const SizedBox(width: 2),
],
),
);
}
@override
Widget buildList(ThemeData theme) {
return TabBarView<TabBarDragGestureRecognizer>(
controller: _tabController,
physics: const CustomTabBarViewScrollPhysics(),
horizontalDragGestureRecognizer: TabBarDragGestureRecognizer(
isDxAllowed: (double dx) => enableSlide
? dx > CommonSlideMixin.offset &&
dx < maxWidth - CommonSlideMixin.offset
: true,
),
children: [
KeepAliveWrapper(builder: (context) => buildList(theme)),
KeepAliveWrapper(builder: (context) => _buildInfo(theme)),
PgcReviewPage(
name: widget.item.title!,
mediaId: widget.item.mediaId,
@@ -94,8 +113,7 @@ class _IntroDetailState extends State<PgcIntroPanel>
);
}
@override
Widget buildList(ThemeData theme) {
Widget _buildInfo(ThemeData theme) {
final TextStyle smallTitle = TextStyle(
fontSize: 12,
color: theme.colorScheme.onSurface,