Merge branch 'design' into alpha

This commit is contained in:
guozhigq
2023-09-07 19:25:49 +08:00
7 changed files with 47 additions and 31 deletions

View File

@ -112,12 +112,22 @@ class VideoCardV extends StatelessWidget {
height: maxHeight, height: maxHeight,
), ),
), ),
if (crossAxisCount == 1 && videoItem.duration != null) if (videoItem.duration != null)
PBadge( if (crossAxisCount == 1) ...[
bottom: 10, PBadge(
right: 10, bottom: 10,
text: videoItem.duration, right: 10,
) text: videoItem.duration,
)
] else ...[
PBadge(
bottom: 6,
right: 7,
size: 'small',
type: 'gray',
text: videoItem.duration,
)
],
], ],
); );
}), }),
@ -174,7 +184,7 @@ class VideoContent extends StatelessWidget {
], ],
), ),
if (crossAxisCount > 1) ...[ if (crossAxisCount > 1) ...[
const SizedBox(height: 3), const SizedBox(height: 2),
VideoStat( VideoStat(
videoItem: videoItem, videoItem: videoItem,
), ),

View File

@ -49,7 +49,7 @@ class RcmdController extends GetxController {
videoList.value = res['data']; videoList.value = res['data'];
} }
} else if (type == 'onRefresh') { } else if (type == 'onRefresh') {
videoList.insertAll(0, res['data']); videoList.value = res['data'];
} else if (type == 'onLoad') { } else if (type == 'onLoad') {
videoList.addAll(res['data']); videoList.addAll(res['data']);
} }

View File

@ -77,7 +77,8 @@ class _RcmdPageState extends State<RcmdPage>
), ),
child: RefreshIndicator( child: RefreshIndicator(
onRefresh: () async { onRefresh: () async {
return await _rcmdController.onRefresh(); await _rcmdController.onRefresh();
await Future.delayed(const Duration(milliseconds: 300));
}, },
child: CustomScrollView( child: CustomScrollView(
controller: _rcmdController.scrollController, controller: _rcmdController.scrollController,

View File

@ -60,6 +60,12 @@ class _PlaySettingState extends State<PlaySetting> {
setKey: SettingBoxKey.autoPlayEnable, setKey: SettingBoxKey.autoPlayEnable,
defaultVal: true, defaultVal: true,
), ),
const SetSwitchItem(
title: '后台播放',
subTitle: '进入后台时继续播放',
setKey: SettingBoxKey.enableBackgroundPlay,
defaultVal: false,
),
const SetSwitchItem( const SetSwitchItem(
title: '自动全屏', title: '自动全屏',
subTitle: '视频开始播放时进入全屏', subTitle: '视频开始播放时进入全屏',

View File

@ -353,14 +353,14 @@ class PlPlayerController {
var pp = player.platform as NativePlayer; var pp = player.platform as NativePlayer;
// 音轨 // 音轨
if (dataSource.audioSource != '' && dataSource.audioSource != null) { // if (dataSource.audioSource != '' && dataSource.audioSource != null) {
await pp.setProperty( // await pp.setProperty(
'audio-files', // 'audio-files',
UniversalPlatform.isWindows // UniversalPlatform.isWindows
? dataSource.audioSource!.replaceAll(';', '\\;') // ? dataSource.audioSource!.replaceAll(';', '\\;')
: dataSource.audioSource!.replaceAll(':', '\\:'), // : dataSource.audioSource!.replaceAll(':', '\\:'),
); // );
} // }
// 字幕 // 字幕
if (dataSource.subFiles != '' && dataSource.subFiles != null) { if (dataSource.subFiles != '' && dataSource.subFiles != null) {
@ -393,21 +393,15 @@ class PlPlayerController {
Media(assetUrl, httpHeaders: dataSource.httpHeaders), Media(assetUrl, httpHeaders: dataSource.httpHeaders),
play: false, play: false,
); );
} else if (dataSource.type == DataSourceType.network) {
player.open(
Media(dataSource.videoSource!, httpHeaders: dataSource.httpHeaders),
play: false,
);
// 音轨
// player.setAudioTrack(
// AudioTrack.uri(dataSource.audioSource!),
// );
} else {
player.open(
Media(dataSource.file!.path, httpHeaders: dataSource.httpHeaders),
play: false,
);
} }
player.open(
Media(dataSource.videoSource!, httpHeaders: dataSource.httpHeaders),
play: false,
);
// 音轨
player.setAudioTrack(
AudioTrack.uri(dataSource.audioSource!),
);
return player; return player;
} }

View File

@ -72,6 +72,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
late FullScreenMode mode; late FullScreenMode mode;
late int defaultBtmProgressBehavior; late int defaultBtmProgressBehavior;
late bool enableQuickDouble; late bool enableQuickDouble;
late bool enableBackgroundPlay;
void onDoubleTapSeekBackward() { void onDoubleTapSeekBackward() {
setState(() { setState(() {
@ -128,6 +129,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
defaultValue: BtmProgresBehavior.values.first.code); defaultValue: BtmProgresBehavior.values.first.code);
enableQuickDouble = enableQuickDouble =
setting.get(SettingBoxKey.enableQuickDouble, defaultValue: true); setting.get(SettingBoxKey.enableQuickDouble, defaultValue: true);
enableBackgroundPlay =
setting.get(SettingBoxKey.enableBackgroundPlay, defaultValue: false);
Future.microtask(() async { Future.microtask(() async {
try { try {
@ -228,6 +231,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
() => Video( () => Video(
controller: videoController, controller: videoController,
controls: NoVideoControls, controls: NoVideoControls,
pauseUponEnteringBackgroundMode: !enableBackgroundPlay,
subtitleViewConfiguration: SubtitleViewConfiguration( subtitleViewConfiguration: SubtitleViewConfiguration(
style: subTitleStyle, style: subTitleStyle,
textAlign: TextAlign.center, textAlign: TextAlign.center,

View File

@ -107,6 +107,7 @@ class SettingBoxKey {
// youtube 双击快进快退 // youtube 双击快进快退
static const String enableQuickDouble = 'enableQuickDouble'; static const String enableQuickDouble = 'enableQuickDouble';
static const String enableShowDanmaku = 'enableShowDanmaku'; static const String enableShowDanmaku = 'enableShowDanmaku';
static const String enableBackgroundPlay = 'enableBackgroundPlay';
/// 隐私 /// 隐私
static const String blackMidsList = 'blackMidsList'; static const String blackMidsList = 'blackMidsList';