Merge branch 'design'

This commit is contained in:
guozhigq
2024-11-28 22:17:45 +08:00
26 changed files with 385 additions and 494 deletions

BIN
assets/images/video/dlna.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

BIN
assets/images/video/pip.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
class DragHandle extends StatelessWidget {
const DragHandle({super.key});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: Navigator.of(context).pop,
child: SizedBox(
height: 36,
child: Center(
child: Container(
width: 32,
height: 4,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius: BorderRadius.circular(4),
),
),
),
),
);
}
}

View File

@ -12,6 +12,7 @@ import '../../http/video.dart';
import '../../utils/utils.dart';
import '../constants.dart';
import 'badge.dart';
import 'drag_handle.dart';
import 'network_img_layer.dart';
import 'stat/danmu.dart';
import 'stat/view.dart';
@ -373,27 +374,12 @@ class MorePanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () => Get.back(),
child: Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))),
),
),
),
),
const DragHandle(),
ListTile(
onTap: () async => await menuActionHandler('block'),
minLeadingWidth: 0,

View File

@ -5,6 +5,7 @@ import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/image_save.dart';
import 'package:pilipala/utils/route_push.dart';
import '../../models/model_rec_video_item.dart';
import 'drag_handle.dart';
import 'stat/danmu.dart';
import 'stat/view.dart';
import '../../http/dynamics.dart';
@ -368,27 +369,12 @@ class MorePanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () => Get.back(),
child: Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))),
),
),
),
),
const DragHandle(),
ListTile(
onTap: () async => await menuActionHandler('block'),
minLeadingWidth: 0,

View File

@ -5,6 +5,7 @@ import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/widgets/badge.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/common/widgets/stat/danmu.dart';
import 'package:pilipala/common/widgets/stat/view.dart';
@ -445,27 +446,12 @@ class BangumiStatusWidget extends StatelessWidget {
}
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
return Container(
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () => Get.back(),
child: Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))),
),
),
),
),
const DragHandle(),
...ctr.followStatusList
.map(
(e) => ListTile(

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/common/widgets/stat/danmu.dart';
import 'package:pilipala/common/widgets/stat/view.dart';
import 'package:pilipala/utils/storage.dart';
@ -23,94 +24,81 @@ class IntroDetail extends StatelessWidget {
color: Theme.of(context).colorScheme.onSurface,
);
return Container(
color: Theme.of(context).colorScheme.surface,
padding: const EdgeInsets.only(left: 14, right: 14),
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
height: sheetHeight,
child: Column(
children: [
Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.onSecondaryContainer
.withOpacity(0.5),
borderRadius: const BorderRadius.all(Radius.circular(3))),
),
),
),
const DragHandle(),
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
bangumiDetail!.title,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
child: Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
bangumiDetail!.title,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
const SizedBox(height: 4),
Row(
children: [
StatView(
view: bangumiDetail!.stat!['views'],
size: 'medium',
),
const SizedBox(width: 6),
StatDanMu(
danmu: bangumiDetail!.stat!['danmakus'],
size: 'medium',
),
],
),
const SizedBox(height: 4),
Row(
children: [
Text(
bangumiDetail!.areas!.first['name'],
style: smallTitle,
),
const SizedBox(width: 6),
Text(
bangumiDetail!.publish!['pub_time_show'],
style: smallTitle,
),
const SizedBox(width: 6),
Text(
bangumiDetail!.newEp!['desc'],
style: smallTitle,
),
],
),
const SizedBox(height: 20),
Text(
'简介:',
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 4),
Text(
'${bangumiDetail!.evaluate!}',
style: smallTitle.copyWith(fontSize: 13),
),
const SizedBox(height: 20),
Text(
'声优:',
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 4),
Text(
bangumiDetail.actors,
style: smallTitle.copyWith(fontSize: 13),
),
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
],
const SizedBox(height: 4),
Row(
children: [
StatView(
view: bangumiDetail!.stat!['views'],
size: 'medium',
),
const SizedBox(width: 6),
StatDanMu(
danmu: bangumiDetail!.stat!['danmakus'],
size: 'medium',
),
],
),
const SizedBox(height: 4),
Row(
children: [
Text(
bangumiDetail!.areas!.first['name'],
style: smallTitle,
),
const SizedBox(width: 6),
Text(
bangumiDetail!.publish!['pub_time_show'],
style: smallTitle,
),
const SizedBox(width: 6),
Text(
bangumiDetail!.newEp!['desc'],
style: smallTitle,
),
],
),
const SizedBox(height: 20),
Text(
'简介:',
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 4),
Text(
'${bangumiDetail!.evaluate!}',
style: smallTitle.copyWith(fontSize: 13),
),
const SizedBox(height: 20),
Text(
'声优:',
style: Theme.of(context).textTheme.titleMedium,
),
const SizedBox(height: 4),
Text(
bangumiDetail.actors,
style: smallTitle.copyWith(fontSize: 13),
),
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
],
),
),
),
)

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/http/user.dart';
import 'package:pilipala/utils/feed_back.dart';
@ -108,28 +109,12 @@ class MorePanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
// clipBehavior: Clip.hardEdge,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () => Get.back(),
child: Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))),
),
),
),
),
const DragHandle(),
ListTile(
onTap: () async {
try {

View File

@ -134,8 +134,9 @@ class FavDetailController extends GetxController {
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
},
);
title.value = res['title'];
print(title);
if (res != null) {
title.value = res['title'];
}
}
Future toViewPlayAll() async {

View File

@ -53,6 +53,7 @@ class FavEditController extends GetxController {
intro: intro,
mediaId: mediaId!,
cover: cover,
privacy: privacy.value,
);
if (res['status']) {
SmartDialog.showToast('编辑成功');
@ -74,4 +75,14 @@ class FavEditController extends GetxController {
SmartDialog.showToast(res['msg']);
}
}
void togglePrivacy() {
if (privacy.value == 0) {
privacy.value = 1;
SmartDialog.showToast('设置为私密后,只有自己可见');
} else {
privacy.value = 0;
SmartDialog.showToast('设置为公开后,所有人可见');
}
}
}

View File

@ -21,31 +21,22 @@ class _FavEditPageState extends State<FavEditPage> {
appBar: AppBar(
title: Obx(
() => _favEditController.type.value == 'add'
? Text(
'新建收藏夹',
style: Theme.of(context).textTheme.titleMedium,
)
: Text(
'编辑收藏夹',
style: Theme.of(context).textTheme.titleMedium,
),
? const Text('新建收藏夹')
: const Text('编辑收藏夹'),
),
actions: [
Obx(
() => _favEditController.privacy.value == 0
? IconButton(
onPressed: () {
_favEditController.privacy.value = 1;
},
icon: const Icon(Icons.lock_open_outlined))
: IconButton(
onPressed: () {
_favEditController.privacy.value = 0;
},
icon: Icon(
Icons.lock_outlined,
color: Theme.of(context).colorScheme.error,
)),
() => IconButton(
onPressed: _favEditController.togglePrivacy,
icon: Icon(
_favEditController.privacy.value == 0
? Icons.lock_open_outlined
: Icons.lock_outlined,
color: _favEditController.privacy.value == 0
? null
: Theme.of(context).colorScheme.error,
),
),
),
TextButton(
onPressed: _favEditController.onSubmit, child: const Text('保存')),

View File

@ -69,7 +69,7 @@ class LiveRoomController extends GetxController {
Request.getBuvid().then((value) => buvid = value);
}
// CDN优化
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
final userInfo = userInfoCache.get('userInfoCache');
if (userInfo != null && userInfo.mid != null) {
userId = userInfo.mid;

View File

@ -31,6 +31,7 @@ class _PlaySettingState extends State<PlaySetting> {
late int defaultFullScreenMode;
late int defaultBtmProgressBehavior;
late String defaultAoOutput;
late String hardwareDecodeFormat;
@override
void initState() {
@ -49,6 +50,8 @@ class _PlaySettingState extends State<PlaySetting> {
defaultValue: BtmProgresBehavior.values.first.code);
defaultAoOutput =
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
hardwareDecodeFormat = setting.get(SettingBoxKey.hardwareDecodeFormat,
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
}
@override
@ -92,7 +95,7 @@ class _PlaySettingState extends State<PlaySetting> {
title: 'CDN优化',
subTitle: '使用优质CDN线路',
setKey: SettingBoxKey.enableCDN,
defaultVal: true,
defaultVal: false,
),
const SetSwitchItem(
title: '自动播放',
@ -294,6 +297,34 @@ class _PlaySettingState extends State<PlaySetting> {
}
},
),
ListTile(
dense: false,
title: Text('硬解方式', style: titleStyle),
subtitle: Text(
'当前硬解方式(--hwdec)$hardwareDecodeFormat',
style: subTitleStyle,
),
onTap: () async {
String? result = await showDialog(
context: context,
builder: (context) {
return SelectDialog<String>(
title: '硬解方式',
value: hardwareDecodeFormat,
values: ['no', 'auto-safe', 'auto', 'yes', 'auto-copy']
.map((e) {
return {'title': e, 'value': e};
}).toList());
},
);
if (result != null) {
setting.put(SettingBoxKey.hardwareDecodeFormat, result);
hardwareDecodeFormat = result;
GlobalDataCache.hardwareDecodeFormat = result;
setState(() {});
}
},
),
ListTile(
dense: false,
title: Text('默认全屏方式', style: titleStyle),

View File

@ -116,6 +116,7 @@ class VideoDetailController extends GetxController
BottomControlType.time,
BottomControlType.space,
BottomControlType.fit,
BottomControlType.speed,
BottomControlType.fullscreen,
].obs;
RxDouble sheetHeight = 0.0.obs;
@ -168,7 +169,7 @@ class VideoDetailController extends GetxController
}
// CDN优化
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
// 预设的画质
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
// 预设的解码格式

View File

@ -7,6 +7,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/widgets/badge.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/http/reply.dart';
import 'package:pilipala/models/common/reply_type.dart';
@ -1117,27 +1118,12 @@ class MorePanel extends StatelessWidget {
ColorScheme colorScheme = Theme.of(context).colorScheme;
TextTheme textTheme = Theme.of(context).textTheme;
Color errorColor = colorScheme.error;
return Container(
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () => Get.back(),
child: Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: colorScheme.outline,
borderRadius: const BorderRadius.all(Radius.circular(3))),
),
),
),
),
const DragHandle(),
ListTile(
onTap: () async => await menuActionHandler('copyAll'),
minLeadingWidth: 0,

View File

@ -680,8 +680,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
forceElevated: innerBoxIsScrolled,
expandedHeight: expandedHeight,
backgroundColor: Colors.black,
flexibleSpace: FlexibleSpaceBar(
background: PopScope(
flexibleSpace: SizedBox.expand(
child: PopScope(
canPop:
plPlayerController?.isFullScreen.value != true,
onPopInvoked: (bool didPop) {

View File

@ -1,6 +1,7 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/models/video/ai.dart';
import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/utils/global_data_cache.dart';
@ -17,21 +18,24 @@ class AiDetail extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(left: 16, right: 16),
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
height: GlobalDataCache.sheetHeight,
child: Column(
children: [
_buildHeader(context),
const DragHandle(),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
if (modelResult!.summary != '') ...[
_buildSummaryText(modelResult!.summary!),
const SizedBox(height: 20),
child: Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Column(
children: [
if (modelResult!.summary != '') ...[
_buildSummaryText(modelResult!.summary!),
const SizedBox(height: 20),
],
_buildOutlineList(context),
],
_buildOutlineList(context),
],
),
),
),
),
@ -40,20 +44,6 @@ class AiDetail extends StatelessWidget {
);
}
Widget _buildHeader(BuildContext context) {
return Center(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).hintColor,
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
height: 4,
width: 40,
margin: const EdgeInsets.symmetric(vertical: 16),
),
);
}
Widget _buildSummaryText(String summary) {
return SelectableText(
summary,

View File

@ -8,6 +8,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:ns_danmaku/ns_danmaku.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/http/user.dart';
import 'package:pilipala/models/video/play/quality.dart';
import 'package:pilipala/models/video/play/url.dart';
@ -56,7 +57,7 @@ class _HeaderControlState extends State<HeaderControl> {
final Box<dynamic> localCache = GStorage.localCache;
final Box<dynamic> videoStorage = GStorage.video;
late List<double> speedsList;
double buttonSpace = 8;
double buttonSpace = 4;
RxBool isFullScreen = false.obs;
late String heroTag;
late VideoIntroController videoIntroController;
@ -102,22 +103,7 @@ class _HeaderControlState extends State<HeaderControl> {
margin: const EdgeInsets.all(12),
child: Column(
children: <Widget>[
SizedBox(
height: 35,
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.onSecondaryContainer
.withOpacity(0.5),
borderRadius:
const BorderRadius.all(Radius.circular(3))),
),
),
),
const DragHandle(),
Expanded(
child: Material(
child: ListView(
@ -486,65 +472,6 @@ class _HeaderControlState extends State<HeaderControl> {
});
}
/// 选择倍速
void showSetSpeedSheet() {
final double currentSpeed = widget.controller!.playbackSpeed;
showDialog(
context: Get.context!,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('播放速度'),
content: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Wrap(
spacing: 8,
runSpacing: 2,
children: [
for (final double i in speedsList) ...<Widget>[
if (i == currentSpeed) ...<Widget>[
FilledButton(
onPressed: () async {
// setState(() => currentSpeed = i),
await widget.controller!.setPlaybackSpeed(i);
Get.back();
},
child: Text(i.toString()),
),
] else ...[
FilledButton.tonal(
onPressed: () async {
// setState(() => currentSpeed = i),
await widget.controller!.setPlaybackSpeed(i);
Get.back();
},
child: Text(i.toString()),
),
]
]
],
);
}),
actions: <Widget>[
TextButton(
onPressed: () => Get.back(),
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () async {
await widget.controller!.setDefaultSpeed();
Get.back();
},
child: const Text('默认速度'),
),
],
);
},
);
}
/// 选择画质
void showSetVideoQa() {
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
@ -1222,7 +1149,7 @@ class _HeaderControlState extends State<HeaderControl> {
fuc: () async {
// 销毁播放器实例
await widget.controller!.dispose(type: 'all');
if (mounted) {
if (context.mounted) {
Navigator.popUntil(
context, (Route<dynamic> route) => route.isFirst);
}
@ -1230,21 +1157,9 @@ class _HeaderControlState extends State<HeaderControl> {
),
],
const Spacer(),
// ComBtn(
// icon: const Icon(
// FontAwesomeIcons.cropSimple,
// size: 15,
// color: Colors.white,
// ),
// fuc: () => _.screenshot(),
// ),
if (GlobalDataCache.enableDlna) ...[
ComBtn(
icon: const Icon(
Icons.cast,
size: 19,
color: Colors.white,
),
icon: Image.asset('assets/images/video/dlna.png', width: 19),
fuc: () async {
showDialog<void>(
context: context,
@ -1255,7 +1170,10 @@ class _HeaderControlState extends State<HeaderControl> {
);
},
),
SizedBox(width: buttonSpace),
],
/// 弹幕开关(全屏时)
if (isFullScreen.value) ...[
SizedBox(
width: 56,
@ -1271,6 +1189,7 @@ class _HeaderControlState extends State<HeaderControl> {
),
),
),
SizedBox(width: buttonSpace),
SizedBox(
width: 34,
height: 34,
@ -1292,8 +1211,10 @@ class _HeaderControlState extends State<HeaderControl> {
),
),
),
SizedBox(width: buttonSpace),
],
SizedBox(width: buttonSpace),
/// pip
if (Platform.isAndroid) ...<Widget>[
SizedBox(
width: 34,
@ -1318,9 +1239,9 @@ class _HeaderControlState extends State<HeaderControl> {
await widget.floating!.enable(aspectRatio: aspectRatio);
} else {}
},
icon: const Icon(
Icons.picture_in_picture_outlined,
size: 19,
icon: Image.asset(
'assets/images/video/pip.png',
width: 19,
color: Colors.white,
),
),
@ -1329,37 +1250,21 @@ class _HeaderControlState extends State<HeaderControl> {
],
/// 字幕
if (widget.showSubtitleBtn)
if (widget.showSubtitleBtn) ...[
ComBtn(
icon: const Icon(
Icons.closed_caption_off,
size: 22,
color: Colors.white,
icon: Icon(
FontAwesomeIcons.closedCaptioning,
size: 16,
color: Colors.white.withOpacity(0.9),
),
fuc: () => showSubtitleDialog(),
),
SizedBox(width: buttonSpace),
Obx(
() => SizedBox(
width: 45,
height: 34,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () => showSetSpeedSheet(),
child: Text(
'${_.playbackSpeed}X',
style: textStyle,
),
),
),
),
SizedBox(width: buttonSpace),
SizedBox(width: buttonSpace),
],
ComBtn(
icon: const Icon(
Icons.more_vert_outlined,
size: 18,
size: 19,
color: Colors.white,
),
fuc: () => showSettingSheet(),

View File

@ -101,25 +101,11 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: SizedBox(
width: double.infinity,
width: double.maxFinite,
height: 50,
child: Row(
children: [
SizedBox(
width: 34,
height: 34,
child: IconButton(
onPressed: () => Get.back(),
icon: Icon(
Icons.arrow_back_ios,
size: 18,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
),
const SizedBox(width: 10),
GestureDetector(
onTap: () {
feedBack();

View File

@ -7,8 +7,8 @@ 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:path_provider/path_provider.dart';
import 'package:pilipala/common/widgets/drag_handle.dart';
import 'package:pilipala/utils/download.dart';
import 'package:share_plus/share_plus.dart';
import 'package:status_bar_control/status_bar_control.dart';
@ -234,17 +234,17 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
@override
Widget build(BuildContext context) {
return InteractiveViewerBoundary(
controller: _transformationController,
boundaryWidth: MediaQuery.of(context).size.width,
onScaleChanged: _onScaleChanged,
onLeftBoundaryHit: _onLeftBoundaryHit,
onRightBoundaryHit: _onRightBoundaryHit,
onNoBoundaryHit: _onNoBoundaryHit,
maxScale: widget.maxScale,
minScale: widget.minScale,
child: Stack(children: [
CustomDismissible(
return Stack(children: [
InteractiveViewerBoundary(
controller: _transformationController,
boundaryWidth: MediaQuery.of(context).size.width,
onScaleChanged: _onScaleChanged,
onLeftBoundaryHit: _onLeftBoundaryHit,
onRightBoundaryHit: _onRightBoundaryHit,
onNoBoundaryHit: _onNoBoundaryHit,
maxScale: widget.maxScale,
minScale: widget.minScale,
child: CustomDismissible(
onDismissed: () {
Navigator.of(context).pop();
widget.onDismissed?.call(_pageController!.page!.floor());
@ -275,53 +275,50 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
},
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
padding: EdgeInsets.fromLTRB(
12, 8, 20, MediaQuery.of(context).padding.bottom + 8),
decoration: _enablePageView
? BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withOpacity(0.3)
],
),
)
: null,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () {
Navigator.of(context).pop();
widget.onDismissed?.call(_pageController!.page!.floor());
},
),
widget.sources.length > 1
? Text(
"${currentIndex! + 1}/${widget.sources.length}",
style: const TextStyle(color: Colors.white),
)
: const SizedBox(),
PopupMenuButton(
itemBuilder: (context) {
return _buildPopupMenuList();
},
child: const Icon(Icons.more_horiz, color: Colors.white),
),
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
padding: EdgeInsets.fromLTRB(
12, 8, 20, MediaQuery.of(context).padding.bottom + 8),
decoration: _enablePageView
? BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.transparent, Colors.black.withOpacity(0.3)],
),
)
: null,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(
icon: const Icon(Icons.close, color: Colors.white),
onPressed: () {
Navigator.of(context).pop();
widget.onDismissed?.call(_pageController!.page!.floor());
},
),
widget.sources.length > 1
? Text(
"${currentIndex! + 1}/${widget.sources.length}",
style: const TextStyle(color: Colors.white),
)
: const SizedBox(),
PopupMenuButton(
itemBuilder: (context) {
return _buildPopupMenuList();
},
child: const Icon(Icons.more_horiz, color: Colors.white),
),
],
),
),
]),
);
),
]);
}
// 图片分享
@ -426,29 +423,13 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
useRootNavigator: true,
isScrollControlled: true,
builder: (context) {
return Container(
return Padding(
padding:
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
InkWell(
onTap: () => Get.back(),
child: Container(
height: 35,
padding: const EdgeInsets.only(bottom: 2),
child: Center(
child: Container(
width: 32,
height: 3,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.outline,
borderRadius:
const BorderRadius.all(Radius.circular(3))),
),
),
),
),
const DragHandle(),
..._buildListTitles(),
],
),

View File

@ -6,6 +6,7 @@ import 'dart:typed_data';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_volume_controller/flutter_volume_controller.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
@ -113,12 +114,13 @@ class PlPlayerController {
// final Durations durations;
List<Map<String, dynamic>> videoFitType = [
{'attr': BoxFit.contain, 'desc': '包含'},
{'attr': BoxFit.cover, 'desc': '覆盖'},
{'attr': BoxFit.fill, 'desc': ''},
{'attr': BoxFit.fitHeight, 'desc': '度适应'},
{'attr': BoxFit.fitWidth, 'desc': '度适应'},
{'attr': BoxFit.scaleDown, 'desc': '小适应'},
{'attr': BoxFit.contain, 'desc': '自动'},
{'attr': BoxFit.cover, 'desc': '铺满'},
{'attr': BoxFit.fill, 'desc': ''},
{'attr': BoxFit.fitHeight, 'desc': ''},
{'attr': BoxFit.fitWidth, 'desc': ''},
{'attr': BoxFit.scaleDown, 'desc': ''},
{'attr': BoxFit.none, 'desc': '原始'},
];
PreferredSizeWidget? headerControl;
@ -470,6 +472,7 @@ class PlPlayerController {
configuration: VideoControllerConfiguration(
enableHardwareAcceleration: enableHA,
androidAttachSurfaceAfterVideoParameters: false,
hwdec: enableHA ? GlobalDataCache.hardwareDecodeFormat : null,
),
);
@ -827,47 +830,53 @@ class PlPlayerController {
}
/// Toggle Change the videofit accordingly
void toggleVideoFit() {
showDialog(
context: Get.context!,
builder: (context) {
return AlertDialog(
title: const Text('画面比例'),
content: StatefulBuilder(builder: (context, StateSetter setState) {
return Wrap(
alignment: WrapAlignment.start,
void toggleVideoFit(String toggleType) {
if (toggleType == 'press') {
final String videoFitDEsc = _videoFitDesc.value;
final int index = videoFitType.indexWhere(
(element) => element['desc'] == videoFitDEsc,
);
final int newIndex = index + 1 >= videoFitType.length ? 0 : index + 1;
_videoFit.value = videoFitType[newIndex]['attr'];
_videoFitDesc.value = videoFitType[newIndex]['desc'];
setVideoFit();
SmartDialog.showToast('画面比例:${videoFitType[newIndex]['desc']}');
} else {
void onPressed(item) {
_videoFit.value = item['attr'];
_videoFitDesc.value = item['desc'];
setVideoFit();
Navigator.of(Get.context!).pop();
}
showDialog(
context: Get.context!,
builder: (context) {
return AlertDialog(
title: const Text('画面比例'),
content: Wrap(
spacing: 8,
runSpacing: 2,
children: [
for (var i in videoFitType) ...[
if (_videoFit.value == i['attr']) ...[
FilledButton(
onPressed: () async {
_videoFit.value = i['attr'];
_videoFitDesc.value = i['desc'];
setVideoFit();
Get.back();
},
onPressed: () => onPressed(i),
child: Text(i['desc']),
),
] else ...[
FilledButton.tonal(
onPressed: () async {
_videoFit.value = i['attr'];
_videoFitDesc.value = i['desc'];
setVideoFit();
Get.back();
},
onPressed: () => onPressed(i),
child: Text(i['desc']),
),
]
]
],
);
}),
);
},
);
),
);
},
);
}
}
/// 缓存fit

View File

@ -301,16 +301,22 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
/// 画面比例
BottomControlType.fit: SizedBox(
width: 45,
height: 30,
child: TextButton(
onPressed: () => _.toggleVideoFit(),
onPressed: () => _.toggleVideoFit('press'),
onLongPress: () => _.toggleVideoFit('longPress'),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
child: Obx(
() => Text(
_.videoFitDEsc.value,
style: const TextStyle(color: Colors.white, fontSize: 13),
style: const TextStyle(
color: Colors.white,
fontSize: 12,
fontWeight: FontWeight.bold,
),
),
),
),
@ -320,29 +326,49 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
BottomControlType.speed: SizedBox(
width: 45,
height: 34,
child: TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () {},
child: Obx(
() => Text(
'${_.playbackSpeed.toString()}X',
style: textStyle,
child: PopupMenuButton<double>(
tooltip: '更改播放速度',
onSelected: (double value) {
_.setPlaybackSpeed(value);
},
initialValue: _.playbackSpeed,
color: Colors.black.withOpacity(0.8),
itemBuilder: (BuildContext context) {
return _.speedsList.map((double speed) {
return PopupMenuItem<double>(
height: 40,
padding: const EdgeInsets.only(left: 20),
value: speed,
child: Text(
'${speed}x',
style: textStyle.copyWith(fontWeight: FontWeight.bold),
),
);
}).toList();
},
child: Container(
width: 45,
height: 34,
alignment: Alignment.center,
margin: const EdgeInsets.only(right: 4),
child: Obx(
() => Text(
'${_.playbackSpeed.toString()}x',
style: textStyle.copyWith(fontWeight: FontWeight.bold),
),
),
),
),
),
/// 字幕
/// 全屏
BottomControlType.fullscreen: ComBtn(
icon: Obx(
() => Icon(
() => Image.asset(
_.isFullScreen.value
? FontAwesomeIcons.compress
: FontAwesomeIcons.expand,
size: 15,
? 'assets/images/video/fullscreen_exit.png'
: 'assets/images/video/fullscreen.png',
width: 19,
color: Colors.white,
),
),
@ -359,6 +385,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
BottomControlType.time,
BottomControlType.space,
BottomControlType.fit,
BottomControlType.speed,
BottomControlType.fullscreen,
];
for (var i = 0; i < userSpecifyItem.length; i++) {
@ -739,29 +766,37 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
// 头部、底部控制条
Obx(
() => Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (widget.headerControl != null || _.headerControl != null)
ClipRect(
if (widget.headerControl != null || _.headerControl != null) ...[
Flexible(
child: ClipRect(
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
position: 'top',
child: widget.headerControl ?? _.headerControl!,
),
),
),
] else ...[
const SizedBox.shrink()
],
Flexible(
flex: _.videoType == 'live' ? 0 : 1,
child: ClipRect(
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
position: 'top',
child: widget.headerControl ?? _.headerControl!,
position: 'bottom',
child: widget.bottomControl ??
BottomControl(
controller: widget.controller,
triggerFullScreen: _.triggerFullScreen,
buildBottomControl: buildBottomControl(),
),
),
),
const Spacer(),
ClipRect(
child: AppBarAni(
controller: animationController,
visible: !_.controlsLock.value && _.showControls.value,
position: 'bottom',
child: widget.bottomControl ??
BottomControl(
controller: widget.controller,
triggerFullScreen: _.triggerFullScreen,
buildBottomControl: buildBottomControl(),
),
),
),
],
),

View File

@ -1,3 +1,4 @@
import 'dart:io';
import 'package:hive/hive.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
@ -55,6 +56,8 @@ class GlobalDataCache {
static late bool enableDynamicSwitch;
// 投屏开关
static bool enableDlna = false;
// 硬件解码格式
static late String hardwareDecodeFormat;
// sponsorBlock开关
static bool enableSponsorBlock = false;
// 视频评论开关
@ -127,6 +130,10 @@ class GlobalDataCache {
enableDynamicSwitch =
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
enableDlna = settingBox.get(SettingBoxKey.enableDlna, defaultValue: false);
hardwareDecodeFormat = settingBox.get(SettingBoxKey.hardwareDecodeFormat,
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
enableDlna = settingBox.get(SettingBoxKey.enableDlna, defaultValue: false);
enableSponsorBlock =
settingBox.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);

View File

@ -117,6 +117,7 @@ class SettingBoxKey {
defaultHomePage = 'defaultHomePage',
enableRelatedVideo = 'enableRelatedVideo',
enableDlna = 'enableDlna',
hardwareDecodeFormat = 'hardwareDecodeFormat',
enableSponsorBlock = 'enableSponsorBlock',
enableComment = 'enableComment';