audio block

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-02-08 21:01:38 +08:00
parent 0c65605ac0
commit 0cb07aef1c
10 changed files with 687 additions and 556 deletions

View File

@@ -6,6 +6,7 @@ import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
import 'package:PiliPlus/common/widgets/gesture/tap_gesture_recognizer.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/progress_bar/audio_video_progress_bar.dart';
import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart';
import 'package:PiliPlus/grpc/bilibili/app/listener/v1.pb.dart';
import 'package:PiliPlus/models/common/image_preview_type.dart';
import 'package:PiliPlus/models/common/image_type.dart';
@@ -29,6 +30,7 @@ import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart' hide DraggableScrollableSheet;
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
class AudioPage extends StatefulWidget {
const AudioPage({super.key});
@@ -87,6 +89,16 @@ class _AudioPageState extends State<AudioPage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
actions: [
if (_controller.isUgc && _controller.enableSponsorBlock)
Obx(() {
if (_controller.segmentProgressList.isNotEmpty) {
return IconButton(
onPressed: _controller.showSBDetail,
icon: const Icon(MdiIcons.advertisements, size: 22),
);
}
return const SizedBox.shrink();
}),
Builder(
builder: (context) {
return PopupMenuButton<ListOrder>(
@@ -107,14 +119,14 @@ class _AudioPageState extends State<AudioPage> {
tooltip: '定时关闭',
onPressed: () => shutdownTimerService
..onPause ??= _controller.onPause
..isPlaying ??= (() => _controller.player?.state.playing ?? false)
..isPlaying ??= _controller.isPlaying
..showScheduleExitDialog(
context,
isFullScreen: false,
),
icon: const Icon(Icons.schedule, size: 22),
),
if (_controller.isVideo)
if (_controller.isUgc)
IconButton(
tooltip: '更多',
onPressed: _showMore,
@@ -754,7 +766,7 @@ class _AudioPageState extends State<AudioPage> {
final baseBarColor = colorScheme.brightness.isDark
? const Color(0x33FFFFFF)
: const Color(0x33999999);
return Obx(
Widget child = Obx(
() => ProgressBar(
progress: _controller.position.value,
total: _controller.duration.value,
@@ -770,6 +782,30 @@ class _AudioPageState extends State<AudioPage> {
onSeek: _onSeek,
),
);
if (_controller.isUgc && _controller.enableSponsorBlock) {
child = Stack(
children: [
child,
Positioned(
left: 0,
right: 0,
bottom: 3.5,
child: Obx(
() {
if (_controller.segmentProgressList.isNotEmpty) {
return SegmentProgressBar(
height: 5,
segments: _controller.segmentProgressList,
);
}
return const SizedBox();
},
),
),
],
);
}
return child;
}
Widget _buildDuration(ColorScheme colorScheme) {
@@ -883,10 +919,8 @@ class _AudioPageState extends State<AudioPage> {
const SizedBox(height: 12),
SelectableText(
audioItem.arc.title,
style: const TextStyle(
height: 1.7,
fontSize: 16,
),
style: const TextStyle(height: 1.7, fontSize: 16),
scrollPhysics: const NeverScrollableScrollPhysics(),
),
const SizedBox(height: 12),
if (audioItem.owner.hasName()) ...[