Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-28 09:55:15 +08:00
parent 7ad48570f0
commit 1b4f588671
12 changed files with 152 additions and 154 deletions

View File

@@ -6,15 +6,16 @@ import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:status_bar_control/status_bar_control.dart';
import 'interactive_viewer_boundary.dart';
import 'interactive_viewer.dart' as custom;
@@ -142,17 +143,21 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
_transformationController!.value = _animation?.value ?? Matrix4.identity();
}
SystemUiMode? mode;
setStatusBar() async {
if (Platform.isIOS || Platform.isAndroid) {
await StatusBarControl.setHidden(
true,
animation: StatusBarAnimation.FADE,
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
);
}
if (Platform.isAndroid &&
(await DeviceInfoPlugin().androidInfo).version.sdkInt < 29) {
mode = SystemUiMode.manual;
}
}
@override
void dispose() async {
void dispose() {
widget.onClose?.call(true);
_player?.dispose();
_pageController?.dispose();
@@ -160,7 +165,10 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
_animationController.dispose();
if (widget.setStatusBar != false) {
if (Platform.isIOS || Platform.isAndroid) {
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
SystemChrome.setEnabledSystemUIMode(
mode ?? SystemUiMode.edgeToEdge,
overlays: SystemUiOverlay.values,
);
}
}
for (int index = 0; index < widget.sources.length; index++) {

View File

@@ -41,134 +41,137 @@ class VideoCardH extends StatelessWidget {
try {
type = videoItem.type;
} catch (_) {}
return Stack(
children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title is String
? videoItem.title
: videoItem.title is List
? (videoItem.title as List)
.map((item) => item['text'])
.join()
: '',
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap?.call();
return;
}
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
}
if (videoItem is HotVideoItemModel &&
videoItem.redirectUrl?.isNotEmpty == true) {
if (Utils.viewPgcFromUri(videoItem.redirectUrl!)) {
return Material(
color: Colors.transparent,
child: Stack(
children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title is String
? videoItem.title
: videoItem.title is List
? (videoItem.title as List)
.map((item) => item['text'])
.join()
: '',
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap?.call();
return;
}
}
try {
final int cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
NetworkImgLayer(
src: videoItem.pic as String,
width: maxWidth,
height: maxHeight,
),
if (videoItem is HotVideoItemModel &&
videoItem.pgcLabel?.isNotEmpty == true)
PBadge(
text: videoItem.pgcLabel,
top: 6.0,
right: 6.0,
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
}
if (videoItem is HotVideoItemModel &&
videoItem.redirectUrl?.isNotEmpty == true) {
if (Utils.viewPgcFromUri(videoItem.redirectUrl!)) {
return;
}
}
try {
final int cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
NetworkImgLayer(
src: videoItem.pic as String,
width: maxWidth,
height: maxHeight,
),
if (videoItem.duration != 0)
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (type != 'video')
PBadge(
text: type,
left: 6.0,
bottom: 6.0,
type: 'primary',
),
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null),
],
);
},
if (videoItem is HotVideoItemModel &&
videoItem.pgcLabel?.isNotEmpty == true)
PBadge(
text: videoItem.pgcLabel,
top: 6.0,
right: 6.0,
),
if (videoItem.duration != 0)
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (type != 'video')
PBadge(
text: type,
left: 6.0,
bottom: 6.0,
type: 'primary',
),
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null),
],
);
},
),
),
),
const SizedBox(width: 10),
videoContent(context),
],
const SizedBox(width: 10),
videoContent(context),
],
),
),
),
),
),
if (source == 'normal')
Positioned(
bottom: 0,
right: 12,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
if (source == 'normal')
Positioned(
bottom: 0,
right: 12,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
),
),
),
],
],
),
);
}

View File

@@ -72,7 +72,7 @@ abstract class CommonPublishPageState<T extends CommonPublishPage>
}
@override
void dispose() async {
void dispose() {
focusNode.dispose();
editController.dispose();
WidgetsBinding.instance.removeObserver(this);

View File

@@ -37,7 +37,6 @@ class _HomePageState extends State<HomePage>
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
appBar: AppBar(toolbarHeight: 0),
body: Column(
@@ -45,12 +44,12 @@ class _HomePageState extends State<HomePage>
if (!_homeController.useSideBar &&
context.orientation == Orientation.portrait)
customAppBar,
if (_homeController.tabs.length > 1) ...[
const SizedBox(height: 4),
if (_homeController.tabs.length > 1)
Material(
color: Theme.of(context).colorScheme.surface,
child: SizedBox(
child: Container(
height: 42,
padding: const EdgeInsets.only(top: 4),
child: TabBar(
controller: _homeController.tabController,
tabs: [
@@ -69,8 +68,8 @@ class _HomePageState extends State<HomePage>
},
),
),
),
] else
)
else
const SizedBox(height: 6),
Expanded(
child: tabBarView(

View File

@@ -157,11 +157,10 @@ class _MainAppState extends State<MainApp>
}
@override
void dispose() async {
void dispose() {
MainApp.routeObserver.unsubscribe(this);
WidgetsBinding.instance.removeObserver(this);
// await GrpcClient.instance.shutdown();
await GStorage.close();
GStorage.close();
EventBus().off(EventName.loginEvent);
PiliScheme.listener?.cancel();
super.dispose();

View File

@@ -75,9 +75,9 @@ class _SearchResultPageState extends State<SearchResultPage>
),
body: Column(
children: [
const SizedBox(height: 4),
Container(
width: double.infinity,
padding: const EdgeInsets.only(top: 4),
color: Theme.of(context).colorScheme.surface,
child: Theme(
data: ThemeData(

View File

@@ -213,7 +213,6 @@ List<SettingsModel> get styleSettings => [
leading: Icon(Icons.fit_screen_outlined),
setKey: SettingBoxKey.videoPlayerRemoveSafeArea,
defaultVal: false,
needReboot: true,
),
SettingsModel(
settingsType: SettingsType.sw1tch,

View File

@@ -637,7 +637,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
toolbarHeight: 0,
),
if (videoDetailController.scrollRatio.value != 0 &&
videoDetailController.scrollCtr.offset != 0)
videoDetailController.scrollCtr.offset != 0 &&
context.orientation == Orientation.portrait)
AppBar(
backgroundColor: Theme.of(context)
.colorScheme
@@ -846,7 +847,8 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
),
);
return videoDetailController.scrollRatio.value == 0 ||
videoDetailController.scrollCtr.offset == 0
videoDetailController.scrollCtr.offset == 0 ||
context.orientation != Orientation.portrait
? const SizedBox.shrink()
: Positioned.fill(
bottom: -2,
@@ -1807,6 +1809,7 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
Widget videoIntro([bool needRelated = true, bool needCtr = true]) {
Widget introPanel() => Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
body: CustomScrollView(
key: const PageStorageKey<String>('简介'),

View File

@@ -1379,7 +1379,6 @@ class PlPlayerController {
bool removeSafeArea = setting.get(SettingBoxKey.videoPlayerRemoveSafeArea,
defaultValue: false);
if (!isFullScreen.value && status) {
// StatusBarControl.setHidden(true, animation: StatusBarAnimation.FADE);
hideStatusBar();
/// 按照视频宽高比决定全屏方向
@@ -1403,7 +1402,6 @@ class PlPlayerController {
await landScape();
}
} else if (isFullScreen.value && !status) {
// StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
if (!removeSafeArea) showStatusBar();
toggleFullScreen(false);
if (mode == FullScreenMode.none) {

View File

@@ -5,7 +5,6 @@ import 'package:device_info_plus/device_info_plus.dart';
import 'package:auto_orientation/auto_orientation.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:status_bar_control/status_bar_control.dart';
import '../../../utils/storage.dart';
@@ -75,7 +74,6 @@ Future<void> hideStatusBar() async {
await SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
);
StatusBarControl.setHidden(true);
}
//退出全屏显示
@@ -94,7 +92,6 @@ Future<void> showStatusBar() async {
mode,
overlays: SystemUiOverlay.values,
);
StatusBarControl.setHidden(false);
} else if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
await const MethodChannel('com.alexmercerind/media_kit_video')
.invokeMethod(

View File

@@ -1741,14 +1741,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.11.1"
status_bar_control:
dependency: "direct main"
description:
name: status_bar_control
sha256: "7f2c1f3f7fd13b85ed284eb7ca3f74ceb8dcfdd25636d3a84186d0a687d36693"
url: "https://pub.dev"
source: hosted
version: "3.2.1"
stream_channel:
dependency: transitive
description:

View File

@@ -139,7 +139,7 @@ dependencies:
url: https://github.com/bggRGjQaUbCoE/canvas_danmaku.git
ref: main
# 状态栏图标控制
status_bar_control: ^3.2.1
# status_bar_control: ^3.2.1
# 代理
system_proxy: ^0.1.0
# pip