Merge branch 'design'
This commit is contained in:
BIN
assets/images/video/dlna.png
Executable file
BIN
assets/images/video/dlna.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
assets/images/video/fullscreen.png
Executable file
BIN
assets/images/video/fullscreen.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 274 B |
BIN
assets/images/video/fullscreen_exit.png
Executable file
BIN
assets/images/video/fullscreen_exit.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 246 B |
BIN
assets/images/video/pip.png
Executable file
BIN
assets/images/video/pip.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
25
lib/common/widgets/drag_handle.dart
Normal file
25
lib/common/widgets/drag_handle.dart
Normal 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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ import '../../http/video.dart';
|
|||||||
import '../../utils/utils.dart';
|
import '../../utils/utils.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
import 'badge.dart';
|
import 'badge.dart';
|
||||||
|
import 'drag_handle.dart';
|
||||||
import 'network_img_layer.dart';
|
import 'network_img_layer.dart';
|
||||||
import 'stat/danmu.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'stat/view.dart';
|
import 'stat/view.dart';
|
||||||
@ -373,27 +374,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async => await menuActionHandler('block'),
|
onTap: () async => await menuActionHandler('block'),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:pilipala/utils/feed_back.dart';
|
|||||||
import 'package:pilipala/utils/image_save.dart';
|
import 'package:pilipala/utils/image_save.dart';
|
||||||
import 'package:pilipala/utils/route_push.dart';
|
import 'package:pilipala/utils/route_push.dart';
|
||||||
import '../../models/model_rec_video_item.dart';
|
import '../../models/model_rec_video_item.dart';
|
||||||
|
import 'drag_handle.dart';
|
||||||
import 'stat/danmu.dart';
|
import 'stat/danmu.dart';
|
||||||
import 'stat/view.dart';
|
import 'stat/view.dart';
|
||||||
import '../../http/dynamics.dart';
|
import '../../http/dynamics.dart';
|
||||||
@ -368,27 +369,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async => await menuActionHandler('block'),
|
onTap: () async => await menuActionHandler('block'),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/constants.dart';
|
import 'package:pilipala/common/constants.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.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/network_img_layer.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
import 'package:pilipala/common/widgets/stat/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
@ -445,27 +446,12 @@ class BangumiStatusWidget extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
Widget morePanel(BuildContext context, BangumiIntroController ctr) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
...ctr.followStatusList
|
...ctr.followStatusList
|
||||||
.map(
|
.map(
|
||||||
(e) => ListTile(
|
(e) => ListTile(
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.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/danmu.dart';
|
||||||
import 'package:pilipala/common/widgets/stat/view.dart';
|
import 'package:pilipala/common/widgets/stat/view.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
@ -23,28 +24,14 @@ class IntroDetail extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
);
|
);
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
padding: const EdgeInsets.only(left: 14, right: 14),
|
|
||||||
height: sheetHeight,
|
height: sheetHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -113,6 +100,7 @@ class IntroDetail extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.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/common/widgets/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/user.dart';
|
import 'package:pilipala/http/user.dart';
|
||||||
import 'package:pilipala/utils/feed_back.dart';
|
import 'package:pilipala/utils/feed_back.dart';
|
||||||
@ -108,28 +109,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
// clipBehavior: Clip.hardEdge,
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -134,8 +134,9 @@ class FavDetailController extends GetxController {
|
|||||||
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
'privacy': [22, 0].contains(item!.attr) ? 0 : 1,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
if (res != null) {
|
||||||
title.value = res['title'];
|
title.value = res['title'];
|
||||||
print(title);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future toViewPlayAll() async {
|
Future toViewPlayAll() async {
|
||||||
|
|||||||
@ -53,6 +53,7 @@ class FavEditController extends GetxController {
|
|||||||
intro: intro,
|
intro: intro,
|
||||||
mediaId: mediaId!,
|
mediaId: mediaId!,
|
||||||
cover: cover,
|
cover: cover,
|
||||||
|
privacy: privacy.value,
|
||||||
);
|
);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
SmartDialog.showToast('编辑成功');
|
SmartDialog.showToast('编辑成功');
|
||||||
@ -74,4 +75,14 @@ class FavEditController extends GetxController {
|
|||||||
SmartDialog.showToast(res['msg']);
|
SmartDialog.showToast(res['msg']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void togglePrivacy() {
|
||||||
|
if (privacy.value == 0) {
|
||||||
|
privacy.value = 1;
|
||||||
|
SmartDialog.showToast('设置为私密后,只有自己可见');
|
||||||
|
} else {
|
||||||
|
privacy.value = 0;
|
||||||
|
SmartDialog.showToast('设置为公开后,所有人可见');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,31 +21,22 @@ class _FavEditPageState extends State<FavEditPage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Obx(
|
title: Obx(
|
||||||
() => _favEditController.type.value == 'add'
|
() => _favEditController.type.value == 'add'
|
||||||
? Text(
|
? const Text('新建收藏夹')
|
||||||
'新建收藏夹',
|
: const Text('编辑收藏夹'),
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
)
|
|
||||||
: Text(
|
|
||||||
'编辑收藏夹',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
Obx(
|
Obx(
|
||||||
() => _favEditController.privacy.value == 0
|
() => IconButton(
|
||||||
? IconButton(
|
onPressed: _favEditController.togglePrivacy,
|
||||||
onPressed: () {
|
|
||||||
_favEditController.privacy.value = 1;
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons.lock_open_outlined))
|
|
||||||
: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
_favEditController.privacy.value = 0;
|
|
||||||
},
|
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.lock_outlined,
|
_favEditController.privacy.value == 0
|
||||||
color: Theme.of(context).colorScheme.error,
|
? Icons.lock_open_outlined
|
||||||
)),
|
: Icons.lock_outlined,
|
||||||
|
color: _favEditController.privacy.value == 0
|
||||||
|
? null
|
||||||
|
: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
onPressed: _favEditController.onSubmit, child: const Text('保存')),
|
||||||
|
|||||||
@ -69,7 +69,7 @@ class LiveRoomController extends GetxController {
|
|||||||
Request.getBuvid().then((value) => buvid = value);
|
Request.getBuvid().then((value) => buvid = value);
|
||||||
}
|
}
|
||||||
// CDN优化
|
// CDN优化
|
||||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||||
final userInfo = userInfoCache.get('userInfoCache');
|
final userInfo = userInfoCache.get('userInfoCache');
|
||||||
if (userInfo != null && userInfo.mid != null) {
|
if (userInfo != null && userInfo.mid != null) {
|
||||||
userId = userInfo.mid;
|
userId = userInfo.mid;
|
||||||
|
|||||||
@ -31,6 +31,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
late int defaultFullScreenMode;
|
late int defaultFullScreenMode;
|
||||||
late int defaultBtmProgressBehavior;
|
late int defaultBtmProgressBehavior;
|
||||||
late String defaultAoOutput;
|
late String defaultAoOutput;
|
||||||
|
late String hardwareDecodeFormat;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -49,6 +50,8 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
defaultValue: BtmProgresBehavior.values.first.code);
|
defaultValue: BtmProgresBehavior.values.first.code);
|
||||||
defaultAoOutput =
|
defaultAoOutput =
|
||||||
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
||||||
|
hardwareDecodeFormat = setting.get(SettingBoxKey.hardwareDecodeFormat,
|
||||||
|
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -92,7 +95,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
title: 'CDN优化',
|
title: 'CDN优化',
|
||||||
subTitle: '使用优质CDN线路',
|
subTitle: '使用优质CDN线路',
|
||||||
setKey: SettingBoxKey.enableCDN,
|
setKey: SettingBoxKey.enableCDN,
|
||||||
defaultVal: true,
|
defaultVal: false,
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '自动播放',
|
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(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('默认全屏方式', style: titleStyle),
|
title: Text('默认全屏方式', style: titleStyle),
|
||||||
|
|||||||
@ -116,6 +116,7 @@ class VideoDetailController extends GetxController
|
|||||||
BottomControlType.time,
|
BottomControlType.time,
|
||||||
BottomControlType.space,
|
BottomControlType.space,
|
||||||
BottomControlType.fit,
|
BottomControlType.fit,
|
||||||
|
BottomControlType.speed,
|
||||||
BottomControlType.fullscreen,
|
BottomControlType.fullscreen,
|
||||||
].obs;
|
].obs;
|
||||||
RxDouble sheetHeight = 0.0.obs;
|
RxDouble sheetHeight = 0.0.obs;
|
||||||
@ -168,7 +169,7 @@ class VideoDetailController extends GetxController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CDN优化
|
// CDN优化
|
||||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: false);
|
||||||
// 预设的画质
|
// 预设的画质
|
||||||
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
|
cacheVideoQa = setting.get(SettingBoxKey.defaultVideoQa);
|
||||||
// 预设的解码格式
|
// 预设的解码格式
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/common/widgets/badge.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/network_img_layer.dart';
|
||||||
import 'package:pilipala/http/reply.dart';
|
import 'package:pilipala/http/reply.dart';
|
||||||
import 'package:pilipala/models/common/reply_type.dart';
|
import 'package:pilipala/models/common/reply_type.dart';
|
||||||
@ -1117,27 +1118,12 @@ class MorePanel extends StatelessWidget {
|
|||||||
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||||
TextTheme textTheme = Theme.of(context).textTheme;
|
TextTheme textTheme = Theme.of(context).textTheme;
|
||||||
Color errorColor = colorScheme.error;
|
Color errorColor = colorScheme.error;
|
||||||
return Container(
|
return Padding(
|
||||||
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () async => await menuActionHandler('copyAll'),
|
onTap: () async => await menuActionHandler('copyAll'),
|
||||||
minLeadingWidth: 0,
|
minLeadingWidth: 0,
|
||||||
|
|||||||
@ -680,8 +680,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
forceElevated: innerBoxIsScrolled,
|
forceElevated: innerBoxIsScrolled,
|
||||||
expandedHeight: expandedHeight,
|
expandedHeight: expandedHeight,
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
flexibleSpace: SizedBox.expand(
|
||||||
background: PopScope(
|
child: PopScope(
|
||||||
canPop:
|
canPop:
|
||||||
plPlayerController?.isFullScreen.value != true,
|
plPlayerController?.isFullScreen.value != true,
|
||||||
onPopInvoked: (bool didPop) {
|
onPopInvoked: (bool didPop) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/models/video/ai.dart';
|
import 'package:pilipala/models/video/ai.dart';
|
||||||
import 'package:pilipala/pages/video/detail/index.dart';
|
import 'package:pilipala/pages/video/detail/index.dart';
|
||||||
import 'package:pilipala/utils/global_data_cache.dart';
|
import 'package:pilipala/utils/global_data_cache.dart';
|
||||||
@ -17,13 +18,15 @@ class AiDetail extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.only(left: 16, right: 16),
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
height: GlobalDataCache.sheetHeight,
|
height: GlobalDataCache.sheetHeight,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildHeader(context),
|
const DragHandle(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (modelResult!.summary != '') ...[
|
if (modelResult!.summary != '') ...[
|
||||||
@ -35,25 +38,12 @@ 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) {
|
Widget _buildSummaryText(String summary) {
|
||||||
return SelectableText(
|
return SelectableText(
|
||||||
summary,
|
summary,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:ns_danmaku/ns_danmaku.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/http/user.dart';
|
||||||
import 'package:pilipala/models/video/play/quality.dart';
|
import 'package:pilipala/models/video/play/quality.dart';
|
||||||
import 'package:pilipala/models/video/play/url.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> localCache = GStorage.localCache;
|
||||||
final Box<dynamic> videoStorage = GStorage.video;
|
final Box<dynamic> videoStorage = GStorage.video;
|
||||||
late List<double> speedsList;
|
late List<double> speedsList;
|
||||||
double buttonSpace = 8;
|
double buttonSpace = 4;
|
||||||
RxBool isFullScreen = false.obs;
|
RxBool isFullScreen = false.obs;
|
||||||
late String heroTag;
|
late String heroTag;
|
||||||
late VideoIntroController videoIntroController;
|
late VideoIntroController videoIntroController;
|
||||||
@ -102,22 +103,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
margin: const EdgeInsets.all(12),
|
margin: const EdgeInsets.all(12),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ListView(
|
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() {
|
void showSetVideoQa() {
|
||||||
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
|
final List<FormatItem> videoFormat = videoInfo.supportFormats!;
|
||||||
@ -1222,7 +1149,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
fuc: () async {
|
fuc: () async {
|
||||||
// 销毁播放器实例
|
// 销毁播放器实例
|
||||||
await widget.controller!.dispose(type: 'all');
|
await widget.controller!.dispose(type: 'all');
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
Navigator.popUntil(
|
Navigator.popUntil(
|
||||||
context, (Route<dynamic> route) => route.isFirst);
|
context, (Route<dynamic> route) => route.isFirst);
|
||||||
}
|
}
|
||||||
@ -1230,21 +1157,9 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// ComBtn(
|
|
||||||
// icon: const Icon(
|
|
||||||
// FontAwesomeIcons.cropSimple,
|
|
||||||
// size: 15,
|
|
||||||
// color: Colors.white,
|
|
||||||
// ),
|
|
||||||
// fuc: () => _.screenshot(),
|
|
||||||
// ),
|
|
||||||
if (GlobalDataCache.enableDlna) ...[
|
if (GlobalDataCache.enableDlna) ...[
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: Image.asset('assets/images/video/dlna.png', width: 19),
|
||||||
Icons.cast,
|
|
||||||
size: 19,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
fuc: () async {
|
fuc: () async {
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -1255,7 +1170,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
SizedBox(width: buttonSpace),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
/// 弹幕开关(全屏时)
|
||||||
if (isFullScreen.value) ...[
|
if (isFullScreen.value) ...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 56,
|
width: 56,
|
||||||
@ -1271,6 +1189,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
SizedBox(width: buttonSpace),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 34,
|
||||||
height: 34,
|
height: 34,
|
||||||
@ -1292,8 +1211,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
|
],
|
||||||
|
|
||||||
|
/// pip
|
||||||
if (Platform.isAndroid) ...<Widget>[
|
if (Platform.isAndroid) ...<Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 34,
|
width: 34,
|
||||||
@ -1318,9 +1239,9 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
await widget.floating!.enable(aspectRatio: aspectRatio);
|
await widget.floating!.enable(aspectRatio: aspectRatio);
|
||||||
} else {}
|
} else {}
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: Image.asset(
|
||||||
Icons.picture_in_picture_outlined,
|
'assets/images/video/pip.png',
|
||||||
size: 19,
|
width: 19,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -1329,37 +1250,21 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
],
|
],
|
||||||
|
|
||||||
/// 字幕
|
/// 字幕
|
||||||
if (widget.showSubtitleBtn)
|
if (widget.showSubtitleBtn) ...[
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: Icon(
|
||||||
Icons.closed_caption_off,
|
FontAwesomeIcons.closedCaptioning,
|
||||||
size: 22,
|
size: 16,
|
||||||
color: Colors.white,
|
color: Colors.white.withOpacity(0.9),
|
||||||
),
|
),
|
||||||
fuc: () => showSubtitleDialog(),
|
fuc: () => showSubtitleDialog(),
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
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),
|
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.more_vert_outlined,
|
Icons.more_vert_outlined,
|
||||||
size: 18,
|
size: 19,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
fuc: () => showSettingSheet(),
|
fuc: () => showSettingSheet(),
|
||||||
|
|||||||
@ -101,25 +101,11 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
automaticallyImplyLeading: false,
|
|
||||||
title: SizedBox(
|
title: SizedBox(
|
||||||
width: double.infinity,
|
width: double.maxFinite,
|
||||||
height: 50,
|
height: 50,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
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(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
feedBack();
|
feedBack();
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:pilipala/common/widgets/drag_handle.dart';
|
||||||
import 'package:pilipala/utils/download.dart';
|
import 'package:pilipala/utils/download.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
import 'package:status_bar_control/status_bar_control.dart';
|
import 'package:status_bar_control/status_bar_control.dart';
|
||||||
@ -234,7 +234,8 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return InteractiveViewerBoundary(
|
return Stack(children: [
|
||||||
|
InteractiveViewerBoundary(
|
||||||
controller: _transformationController,
|
controller: _transformationController,
|
||||||
boundaryWidth: MediaQuery.of(context).size.width,
|
boundaryWidth: MediaQuery.of(context).size.width,
|
||||||
onScaleChanged: _onScaleChanged,
|
onScaleChanged: _onScaleChanged,
|
||||||
@ -243,8 +244,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
onNoBoundaryHit: _onNoBoundaryHit,
|
onNoBoundaryHit: _onNoBoundaryHit,
|
||||||
maxScale: widget.maxScale,
|
maxScale: widget.maxScale,
|
||||||
minScale: widget.minScale,
|
minScale: widget.minScale,
|
||||||
child: Stack(children: [
|
child: CustomDismissible(
|
||||||
CustomDismissible(
|
|
||||||
onDismissed: () {
|
onDismissed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
widget.onDismissed?.call(_pageController!.page!.floor());
|
widget.onDismissed?.call(_pageController!.page!.floor());
|
||||||
@ -275,6 +275,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
@ -287,10 +288,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
gradient: LinearGradient(
|
gradient: LinearGradient(
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
colors: [
|
colors: [Colors.transparent, Colors.black.withOpacity(0.3)],
|
||||||
Colors.transparent,
|
|
||||||
Colors.black.withOpacity(0.3)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
@ -320,8 +318,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
]),
|
]);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图片分享
|
// 图片分享
|
||||||
@ -426,29 +423,13 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
|
|||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return Container(
|
return Padding(
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
InkWell(
|
const DragHandle(),
|
||||||
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))),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
..._buildListTitles(),
|
..._buildListTitles(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import 'dart:typed_data';
|
|||||||
|
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:flutter/material.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:flutter_volume_controller/flutter_volume_controller.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
@ -113,12 +114,13 @@ class PlPlayerController {
|
|||||||
// final Durations durations;
|
// final Durations durations;
|
||||||
|
|
||||||
List<Map<String, dynamic>> videoFitType = [
|
List<Map<String, dynamic>> videoFitType = [
|
||||||
{'attr': BoxFit.contain, 'desc': '包含'},
|
{'attr': BoxFit.contain, 'desc': '自动'},
|
||||||
{'attr': BoxFit.cover, 'desc': '覆盖'},
|
{'attr': BoxFit.cover, 'desc': '铺满'},
|
||||||
{'attr': BoxFit.fill, 'desc': '填充'},
|
{'attr': BoxFit.fill, 'desc': '填满'},
|
||||||
{'attr': BoxFit.fitHeight, 'desc': '高度适应'},
|
{'attr': BoxFit.fitHeight, 'desc': '等高'},
|
||||||
{'attr': BoxFit.fitWidth, 'desc': '宽度适应'},
|
{'attr': BoxFit.fitWidth, 'desc': '等宽'},
|
||||||
{'attr': BoxFit.scaleDown, 'desc': '缩小适应'},
|
{'attr': BoxFit.scaleDown, 'desc': '缩放'},
|
||||||
|
{'attr': BoxFit.none, 'desc': '原始'},
|
||||||
];
|
];
|
||||||
|
|
||||||
PreferredSizeWidget? headerControl;
|
PreferredSizeWidget? headerControl;
|
||||||
@ -470,6 +472,7 @@ class PlPlayerController {
|
|||||||
configuration: VideoControllerConfiguration(
|
configuration: VideoControllerConfiguration(
|
||||||
enableHardwareAcceleration: enableHA,
|
enableHardwareAcceleration: enableHA,
|
||||||
androidAttachSurfaceAfterVideoParameters: false,
|
androidAttachSurfaceAfterVideoParameters: false,
|
||||||
|
hwdec: enableHA ? GlobalDataCache.hardwareDecodeFormat : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -827,48 +830,54 @@ class PlPlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Toggle Change the videofit accordingly
|
/// Toggle Change the videofit accordingly
|
||||||
void toggleVideoFit() {
|
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(
|
showDialog(
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('画面比例'),
|
title: const Text('画面比例'),
|
||||||
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
content: Wrap(
|
||||||
return Wrap(
|
|
||||||
alignment: WrapAlignment.start,
|
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
runSpacing: 2,
|
runSpacing: 2,
|
||||||
children: [
|
children: [
|
||||||
for (var i in videoFitType) ...[
|
for (var i in videoFitType) ...[
|
||||||
if (_videoFit.value == i['attr']) ...[
|
if (_videoFit.value == i['attr']) ...[
|
||||||
FilledButton(
|
FilledButton(
|
||||||
onPressed: () async {
|
onPressed: () => onPressed(i),
|
||||||
_videoFit.value = i['attr'];
|
|
||||||
_videoFitDesc.value = i['desc'];
|
|
||||||
setVideoFit();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text(i['desc']),
|
child: Text(i['desc']),
|
||||||
),
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
onPressed: () async {
|
onPressed: () => onPressed(i),
|
||||||
_videoFit.value = i['attr'];
|
|
||||||
_videoFitDesc.value = i['desc'];
|
|
||||||
setVideoFit();
|
|
||||||
Get.back();
|
|
||||||
},
|
|
||||||
child: Text(i['desc']),
|
child: Text(i['desc']),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
);
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 缓存fit
|
/// 缓存fit
|
||||||
Future<void> setVideoFit() async {
|
Future<void> setVideoFit() async {
|
||||||
|
|||||||
@ -301,16 +301,22 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
|
|
||||||
/// 画面比例
|
/// 画面比例
|
||||||
BottomControlType.fit: SizedBox(
|
BottomControlType.fit: SizedBox(
|
||||||
|
width: 45,
|
||||||
height: 30,
|
height: 30,
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => _.toggleVideoFit(),
|
onPressed: () => _.toggleVideoFit('press'),
|
||||||
|
onLongPress: () => _.toggleVideoFit('longPress'),
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||||
),
|
),
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
_.videoFitDEsc.value,
|
_.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(
|
BottomControlType.speed: SizedBox(
|
||||||
width: 45,
|
width: 45,
|
||||||
height: 34,
|
height: 34,
|
||||||
child: TextButton(
|
child: PopupMenuButton<double>(
|
||||||
style: ButtonStyle(
|
tooltip: '更改播放速度',
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
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),
|
||||||
),
|
),
|
||||||
onPressed: () {},
|
);
|
||||||
|
}).toList();
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
width: 45,
|
||||||
|
height: 34,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
margin: const EdgeInsets.only(right: 4),
|
||||||
child: Obx(
|
child: Obx(
|
||||||
() => Text(
|
() => Text(
|
||||||
'${_.playbackSpeed.toString()}X',
|
'${_.playbackSpeed.toString()}x',
|
||||||
style: textStyle,
|
style: textStyle.copyWith(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
/// 字幕
|
|
||||||
/// 全屏
|
/// 全屏
|
||||||
BottomControlType.fullscreen: ComBtn(
|
BottomControlType.fullscreen: ComBtn(
|
||||||
icon: Obx(
|
icon: Obx(
|
||||||
() => Icon(
|
() => Image.asset(
|
||||||
_.isFullScreen.value
|
_.isFullScreen.value
|
||||||
? FontAwesomeIcons.compress
|
? 'assets/images/video/fullscreen_exit.png'
|
||||||
: FontAwesomeIcons.expand,
|
: 'assets/images/video/fullscreen.png',
|
||||||
size: 15,
|
width: 19,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -359,6 +385,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
BottomControlType.time,
|
BottomControlType.time,
|
||||||
BottomControlType.space,
|
BottomControlType.space,
|
||||||
BottomControlType.fit,
|
BottomControlType.fit,
|
||||||
|
BottomControlType.speed,
|
||||||
BottomControlType.fullscreen,
|
BottomControlType.fullscreen,
|
||||||
];
|
];
|
||||||
for (var i = 0; i < userSpecifyItem.length; i++) {
|
for (var i = 0; i < userSpecifyItem.length; i++) {
|
||||||
@ -739,9 +766,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
// 头部、底部控制条
|
// 头部、底部控制条
|
||||||
Obx(
|
Obx(
|
||||||
() => Column(
|
() => Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
if (widget.headerControl != null || _.headerControl != null)
|
if (widget.headerControl != null || _.headerControl != null) ...[
|
||||||
ClipRect(
|
Flexible(
|
||||||
|
child: ClipRect(
|
||||||
child: AppBarAni(
|
child: AppBarAni(
|
||||||
controller: animationController,
|
controller: animationController,
|
||||||
visible: !_.controlsLock.value && _.showControls.value,
|
visible: !_.controlsLock.value && _.showControls.value,
|
||||||
@ -749,8 +778,13 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
child: widget.headerControl ?? _.headerControl!,
|
child: widget.headerControl ?? _.headerControl!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
),
|
||||||
ClipRect(
|
] else ...[
|
||||||
|
const SizedBox.shrink()
|
||||||
|
],
|
||||||
|
Flexible(
|
||||||
|
flex: _.videoType == 'live' ? 0 : 1,
|
||||||
|
child: ClipRect(
|
||||||
child: AppBarAni(
|
child: AppBarAni(
|
||||||
controller: animationController,
|
controller: animationController,
|
||||||
visible: !_.controlsLock.value && _.showControls.value,
|
visible: !_.controlsLock.value && _.showControls.value,
|
||||||
@ -763,6 +797,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:io';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||||
@ -55,6 +56,8 @@ class GlobalDataCache {
|
|||||||
static late bool enableDynamicSwitch;
|
static late bool enableDynamicSwitch;
|
||||||
// 投屏开关
|
// 投屏开关
|
||||||
static bool enableDlna = false;
|
static bool enableDlna = false;
|
||||||
|
// 硬件解码格式
|
||||||
|
static late String hardwareDecodeFormat;
|
||||||
// sponsorBlock开关
|
// sponsorBlock开关
|
||||||
static bool enableSponsorBlock = false;
|
static bool enableSponsorBlock = false;
|
||||||
// 视频评论开关
|
// 视频评论开关
|
||||||
@ -127,6 +130,10 @@ class GlobalDataCache {
|
|||||||
enableDynamicSwitch =
|
enableDynamicSwitch =
|
||||||
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
enableDlna = settingBox.get(SettingBoxKey.enableDlna, defaultValue: false);
|
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 =
|
enableSponsorBlock =
|
||||||
settingBox.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
settingBox.get(SettingBoxKey.enableSponsorBlock, defaultValue: false);
|
||||||
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
settingBox.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
|
|||||||
@ -117,6 +117,7 @@ class SettingBoxKey {
|
|||||||
defaultHomePage = 'defaultHomePage',
|
defaultHomePage = 'defaultHomePage',
|
||||||
enableRelatedVideo = 'enableRelatedVideo',
|
enableRelatedVideo = 'enableRelatedVideo',
|
||||||
enableDlna = 'enableDlna',
|
enableDlna = 'enableDlna',
|
||||||
|
hardwareDecodeFormat = 'hardwareDecodeFormat',
|
||||||
enableSponsorBlock = 'enableSponsorBlock',
|
enableSponsorBlock = 'enableSponsorBlock',
|
||||||
enableComment = 'enableComment';
|
enableComment = 'enableComment';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user