Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-23 10:20:23 +08:00
parent e8a32a6149
commit da52cac2c6
6 changed files with 62 additions and 58 deletions

View File

@@ -2,7 +2,7 @@
enum SearchType { enum SearchType {
// all('综合'), // all('综合'),
// 视频video // 视频video
video('视频', hasHeader: true), video('视频'),
// 番剧media_bangumi, // 番剧media_bangumi,
media_bangumi('番剧'), media_bangumi('番剧'),
// 影视media_ft // 影视media_ft
@@ -16,13 +16,12 @@ enum SearchType {
// 话题topic // 话题topic
// topic, // topic,
// 用户bili_user // 用户bili_user
bili_user('用户', hasHeader: true), bili_user('用户'),
// 专栏article // 专栏article
article('专栏', hasHeader: true); article('专栏');
// 相簿photo // 相簿photo
// photo // photo
final bool hasHeader;
final String label; final String label;
const SearchType(this.label, {this.hasHeader = false}); const SearchType(this.label);
} }

View File

@@ -735,8 +735,8 @@ class _AudioPageState extends State<AudioPage> {
final baseBarColor = colorScheme.brightness.isDark final baseBarColor = colorScheme.brightness.isDark
? const Color(0x33FFFFFF) ? const Color(0x33FFFFFF)
: const Color(0x33999999); : const Color(0x33999999);
return Obx(() { final child = Obx(
final child = ProgressBar( () => ProgressBar(
progress: _controller.position.value, progress: _controller.position.value,
total: _controller.duration.value, total: _controller.duration.value,
baseBarColor: baseBarColor, baseBarColor: baseBarColor,
@@ -749,6 +749,7 @@ class _AudioPageState extends State<AudioPage> {
onDragStart: _onDragStart, onDragStart: _onDragStart,
onDragUpdate: _onDragUpdate, onDragUpdate: _onDragUpdate,
onSeek: _onSeek, onSeek: _onSeek,
),
); );
if (Utils.isDesktop) { if (Utils.isDesktop) {
return MouseRegion( return MouseRegion(
@@ -757,7 +758,6 @@ class _AudioPageState extends State<AudioPage> {
); );
} }
return child; return child;
});
} }
Widget _buildDuration(ColorScheme colorScheme) { Widget _buildDuration(ColorScheme colorScheme) {

View File

@@ -42,8 +42,13 @@ abstract class CommonSearchPanelState<
controller: controller.scrollController, controller: controller.scrollController,
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
slivers: [ slivers: [
if (widget.searchType.hasHeader) buildHeader(theme), ?buildHeader(theme),
Obx(() => _buildBody(theme, controller.loadingState.value)), SliverPadding(
padding: EdgeInsets.only(
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
),
sliver: Obx(() => _buildBody(theme, controller.loadingState.value)),
),
], ],
), ),
); );
@@ -56,12 +61,7 @@ abstract class CommonSearchPanelState<
Loading() => buildLoading, Loading() => buildLoading,
Success(:var response) => Success(:var response) =>
response?.isNotEmpty == true response?.isNotEmpty == true
? SliverPadding( ? buildList(theme, response!)
padding: EdgeInsets.only(
bottom: MediaQuery.viewPaddingOf(context).bottom + 100,
),
sliver: buildList(theme, response!),
)
: HttpError(onReload: controller.onReload), : HttpError(onReload: controller.onReload),
Error(:var errMsg) => HttpError( Error(:var errMsg) => HttpError(
errMsg: errMsg, errMsg: errMsg,
@@ -70,7 +70,7 @@ abstract class CommonSearchPanelState<
}; };
} }
Widget buildHeader(ThemeData theme) => throw UnimplementedError(); Widget? buildHeader(ThemeData theme) => null;
Widget buildList(ThemeData theme, List<T> list); Widget buildList(ThemeData theme, List<T> list);
} }

View File

@@ -76,6 +76,7 @@ class _MediaListPanelState extends State<MediaListPanel>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
actions: [ actions: [
iconButton( iconButton(
iconSize: 20,
tooltip: widget.desc ? '顺序播放' : '倒序播放', tooltip: widget.desc ? '顺序播放' : '倒序播放',
icon: widget.desc icon: widget.desc
? const Icon(MdiIcons.sortAscending) ? const Icon(MdiIcons.sortAscending)
@@ -86,6 +87,7 @@ class _MediaListPanelState extends State<MediaListPanel>
}, },
), ),
iconButton( iconButton(
iconSize: 20,
tooltip: '关闭', tooltip: '关闭',
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Get.back, onPressed: Get.back,

View File

@@ -86,28 +86,16 @@ class BottomControl extends StatelessWidget {
); );
} }
return Padding( Widget progressBar() {
padding: const EdgeInsets.fromLTRB(10, 0, 10, 12), final child = Obx(() {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 7),
child: Obx(
() => Stack(
clipBehavior: Clip.none,
alignment: Alignment.bottomCenter,
children: [
Obx(() {
final int value = controller.sliderPositionSeconds.value; final int value = controller.sliderPositionSeconds.value;
final int max = controller.durationSeconds.value.inSeconds; final int max = controller.durationSeconds.value.inSeconds;
final int buffer = controller.bufferedSeconds.value;
if (value > max || max <= 0) { if (value > max || max <= 0) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
final child = ProgressBar( return ProgressBar(
progress: Duration(seconds: value), progress: Duration(seconds: value),
buffered: Duration(seconds: buffer), buffered: Duration(seconds: controller.bufferedSeconds.value),
total: Duration(seconds: max), total: Duration(seconds: max),
progressBarColor: primary, progressBarColor: primary,
baseBarColor: const Color(0x33FFFFFF), baseBarColor: const Color(0x33FFFFFF),
@@ -121,6 +109,7 @@ class BottomControl extends StatelessWidget {
onDragUpdate: (e) => onDragUpdate(e, max), onDragUpdate: (e) => onDragUpdate(e, max),
onSeek: (e) => onSeek(e, max), onSeek: (e) => onSeek(e, max),
); );
});
if (Utils.isDesktop) { if (Utils.isDesktop) {
return MouseRegion( return MouseRegion(
cursor: SystemMouseCursors.click, cursor: SystemMouseCursors.click,
@@ -128,7 +117,21 @@ class BottomControl extends StatelessWidget {
); );
} }
return child; return child;
}), }
return Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 12),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 7),
child: Obx(
() => Stack(
clipBehavior: Clip.none,
alignment: Alignment.bottomCenter,
children: [
progressBar(),
if (controller.enableSponsorBlock && if (controller.enableSponsorBlock &&
videoDetailController.segmentProgressList.isNotEmpty) videoDetailController.segmentProgressList.isNotEmpty)
Positioned( Positioned(

View File

@@ -197,7 +197,7 @@ abstract class ImageUtils {
cancelToken: cancelToken, cancelToken: cancelToken,
); );
if (Utils.isMobile) { if (Platform.isAndroid) {
if (response.statusCode == 200) { if (response.statusCode == 200) {
await SaverGallery.saveFile( await SaverGallery.saveFile(
filePath: filePath, filePath: filePath,
@@ -214,7 +214,7 @@ abstract class ImageUtils {
del: true, del: true,
); );
} else { } else {
if (Utils.isMobile) { if (Platform.isAndroid) {
await SaverGallery.saveFile( await SaverGallery.saveFile(
filePath: file.path, filePath: file.path,
fileName: name, fileName: name,
@@ -227,7 +227,7 @@ abstract class ImageUtils {
} }
}); });
final result = await Future.wait(futures, eagerError: true); final result = await Future.wait(futures, eagerError: true);
if (!Utils.isMobile) { if (!Platform.isAndroid) {
for (var res in result) { for (var res in result) {
if (res.statusCode == 200) { if (res.statusCode == 200) {
await saveFileImg( await saveFileImg(