Compare commits
23 Commits
alpha
...
fix-replyP
Author | SHA1 | Date | |
---|---|---|---|
f81f348a3e | |||
4191cafe78 | |||
ae33cbf7ca | |||
fca7c36203 | |||
5fc783ebc2 | |||
98122aeaae | |||
f0d8e2a122 | |||
f815affff9 | |||
fce701090a | |||
d6da2a8a47 | |||
b3e162c8d3 | |||
e5eae93a78 | |||
962dcca6d4 | |||
be56fb721f | |||
ce1c80fd86 | |||
33ef18ef1d | |||
ba61e38c9b | |||
0b0db1a2b1 | |||
a9d73a9f1b | |||
0b5397ec00 | |||
466214b26a | |||
db03cdd442 | |||
542975d0ec |
@ -231,6 +231,7 @@ class VideoContent extends StatelessWidget {
|
||||
const SizedBox(height: 2),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
crossAxisCount: crossAxisCount,
|
||||
),
|
||||
],
|
||||
if (crossAxisCount == 1) const SizedBox(height: 4),
|
||||
@ -294,6 +295,7 @@ class VideoContent extends StatelessWidget {
|
||||
),
|
||||
VideoStat(
|
||||
videoItem: videoItem,
|
||||
crossAxisCount: crossAxisCount,
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
@ -317,10 +319,12 @@ class VideoContent extends StatelessWidget {
|
||||
|
||||
class VideoStat extends StatelessWidget {
|
||||
final dynamic videoItem;
|
||||
final int crossAxisCount;
|
||||
|
||||
const VideoStat({
|
||||
Key? key,
|
||||
required this.videoItem,
|
||||
required this.crossAxisCount,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -337,7 +341,7 @@ class VideoStat extends StatelessWidget {
|
||||
danmu: videoItem.stat.danmu,
|
||||
),
|
||||
if (videoItem is RecVideoItemModel) ...<Widget>[
|
||||
const Spacer(),
|
||||
crossAxisCount > 1 ? const Spacer() : const SizedBox(width: 8),
|
||||
RichText(
|
||||
maxLines: 1,
|
||||
text: TextSpan(
|
||||
|
12
lib/models/common/gesture_mode.dart
Normal file
12
lib/models/common/gesture_mode.dart
Normal file
@ -0,0 +1,12 @@
|
||||
enum FullScreenGestureMode {
|
||||
/// 从上滑到下
|
||||
fromToptoBottom,
|
||||
|
||||
/// 从下滑到上
|
||||
fromBottomtoTop,
|
||||
}
|
||||
|
||||
extension FullScreenGestureModeExtension on FullScreenGestureMode {
|
||||
String get values => ['fromToptoBottom', 'fromBottomtoTop'][index];
|
||||
String get labels => ['从上往下滑进入全屏', '从下往上滑进入全屏'][index];
|
||||
}
|
4
lib/models/common/index.dart
Normal file
4
lib/models/common/index.dart
Normal file
@ -0,0 +1,4 @@
|
||||
library commonn_model;
|
||||
|
||||
export './business_type.dart';
|
||||
export './gesture_mode.dart';
|
@ -2,15 +2,22 @@ class FollowUpModel {
|
||||
FollowUpModel({
|
||||
this.liveUsers,
|
||||
this.upList,
|
||||
this.liveList,
|
||||
});
|
||||
|
||||
LiveUsers? liveUsers;
|
||||
List<UpItem>? upList;
|
||||
List<LiveUserItem>? liveList;
|
||||
|
||||
FollowUpModel.fromJson(Map<String, dynamic> json) {
|
||||
liveUsers = json['live_users'] != null
|
||||
? LiveUsers.fromJson(json['live_users'])
|
||||
: null;
|
||||
liveList = json['live_users'] != null
|
||||
? json['live_users']['items']
|
||||
.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
|
||||
.toList()
|
||||
: [];
|
||||
upList = json['up_list'] != null
|
||||
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
|
||||
: [];
|
||||
|
@ -15,7 +15,7 @@ class FavFolderData {
|
||||
? json['list']
|
||||
.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
|
||||
.toList()
|
||||
: [FavFolderItemData()];
|
||||
: <FavFolderItemData>[];
|
||||
hasMore = json['has_more'];
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
class BangumiController extends GetxController {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
RxList<BangumiListItemModel> bangumiList = [BangumiListItemModel()].obs;
|
||||
RxList<BangumiListItemModel> bangumiFollowList = [BangumiListItemModel()].obs;
|
||||
RxList<BangumiListItemModel> bangumiList = <BangumiListItemModel>[].obs;
|
||||
RxList<BangumiListItemModel> bangumiFollowList = <BangumiListItemModel>[].obs;
|
||||
int _currentPage = 1;
|
||||
bool isLoadingMore = true;
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
|
@ -139,7 +139,7 @@ class BlackListController extends GetxController {
|
||||
int currentPage = 1;
|
||||
int pageSize = 50;
|
||||
RxInt total = 0.obs;
|
||||
RxList<BlackListItem> blackList = [BlackListItem()].obs;
|
||||
RxList<BlackListItem> blackList = <BlackListItem>[].obs;
|
||||
|
||||
Future queryBlacklist({type = 'init'}) async {
|
||||
if (type == 'init') {
|
||||
|
@ -20,7 +20,7 @@ import 'package:pilipala/utils/utils.dart';
|
||||
class DynamicsController extends GetxController {
|
||||
int page = 1;
|
||||
String? offset = '';
|
||||
RxList<DynamicItemModel> dynamicsList = [DynamicItemModel()].obs;
|
||||
RxList<DynamicItemModel> dynamicsList = <DynamicItemModel>[].obs;
|
||||
Rx<DynamicsType> dynamicsType = DynamicsType.values[0].obs;
|
||||
RxString dynamicsTypeLabel = '全部'.obs;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
@ -105,7 +105,7 @@ class DynamicsController extends GetxController {
|
||||
|
||||
onSelectType(value) async {
|
||||
dynamicsType.value = filterTypeList[value]['value'];
|
||||
dynamicsList.value = [DynamicItemModel()];
|
||||
dynamicsList.value = <DynamicItemModel>[];
|
||||
page = 1;
|
||||
initialValue.value = value;
|
||||
await queryFollowDynamic();
|
||||
@ -249,8 +249,8 @@ class DynamicsController extends GetxController {
|
||||
return {'status': false, 'msg': '账号未登录'};
|
||||
}
|
||||
if (type == 'init') {
|
||||
upData.value.upList = [];
|
||||
upData.value.liveUsers = LiveUsers();
|
||||
upData.value.upList = <UpItem>[];
|
||||
upData.value.liveList = <LiveUserItem>[];
|
||||
}
|
||||
var res = await DynamicsHttp.followUp();
|
||||
if (res['status']) {
|
||||
@ -264,14 +264,13 @@ class DynamicsController extends GetxController {
|
||||
|
||||
onSelectUp(mid) async {
|
||||
dynamicsType.value = DynamicsType.values[0];
|
||||
dynamicsList.value = [DynamicItemModel()];
|
||||
dynamicsList.value = <DynamicItemModel>[];
|
||||
page = 1;
|
||||
queryFollowDynamic();
|
||||
}
|
||||
|
||||
onRefresh() async {
|
||||
page = 1;
|
||||
print('onRefresh');
|
||||
await queryFollowUp();
|
||||
await queryFollowDynamic();
|
||||
}
|
||||
@ -293,7 +292,7 @@ class DynamicsController extends GetxController {
|
||||
dynamicsType.value = DynamicsType.values[0];
|
||||
initialValue.value = 0;
|
||||
SmartDialog.showToast('还原默认加载');
|
||||
dynamicsList.value = [DynamicItemModel()];
|
||||
dynamicsList.value = <DynamicItemModel>[];
|
||||
queryFollowDynamic();
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class DynamicDetailController extends GetxController {
|
||||
int currentPage = 0;
|
||||
bool isLoadingMore = false;
|
||||
RxString noMore = ''.obs;
|
||||
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
||||
RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
|
||||
RxInt acount = 0.obs;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
|
@ -45,7 +45,9 @@ class _ContentState extends State<Content> {
|
||||
if (len == 1) {
|
||||
OpusPicsModel pictureItem = pics.first;
|
||||
picList.add(pictureItem.url!);
|
||||
spanChilds.add(const TextSpan(text: '\n'));
|
||||
|
||||
/// 图片上方的空白间隔
|
||||
// spanChilds.add(const TextSpan(text: '\n'));
|
||||
spanChilds.add(
|
||||
WidgetSpan(
|
||||
child: LayoutBuilder(
|
||||
|
@ -19,6 +19,17 @@ InlineSpan richNode(item, context) {
|
||||
// 动态页面 richTextNodes 层级可能与主页动态层级不同
|
||||
richTextNodes =
|
||||
item.modules.moduleDynamic.major.opus.summary.richTextNodes;
|
||||
if (item.modules.moduleDynamic.major.opus.title != null) {
|
||||
spanChilds.add(
|
||||
TextSpan(
|
||||
text: item.modules.moduleDynamic.major.opus.title + '\n',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.titleMedium!
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (richTextNodes == null || richTextNodes.isEmpty) {
|
||||
return spacer;
|
||||
|
@ -31,8 +31,8 @@ class _UpPanelState extends State<UpPanel> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
upList = widget.upData!.upList!;
|
||||
if (widget.upData!.liveUsers != null) {
|
||||
liveList = widget.upData!.liveUsers!.items!;
|
||||
if (widget.upData!.liveList!.isNotEmpty) {
|
||||
liveList = widget.upData!.liveList!;
|
||||
}
|
||||
upList.insert(
|
||||
0,
|
||||
@ -55,7 +55,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
floating: true,
|
||||
pinned: false,
|
||||
delegate: _SliverHeaderDelegate(
|
||||
height: 126,
|
||||
height: liveList.isNotEmpty || upList.isNotEmpty ? 126 : 0,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -90,7 +90,7 @@ class _UpPanelState extends State<UpPanel> {
|
||||
color: Theme.of(context).colorScheme.background,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
controller: scrollController,
|
||||
|
@ -10,7 +10,7 @@ class FansController extends GetxController {
|
||||
int pn = 1;
|
||||
int ps = 20;
|
||||
int total = 0;
|
||||
RxList<FansItemModel> fansList = [FansItemModel()].obs;
|
||||
RxList<FansItemModel> fansList = <FansItemModel>[].obs;
|
||||
late int mid;
|
||||
late String name;
|
||||
var userInfo;
|
||||
|
@ -58,6 +58,9 @@ class _HomePageState extends State<HomePage>
|
||||
return Scaffold(
|
||||
extendBody: true,
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: _homeController.enableGradientBg
|
||||
? null
|
||||
: AppBar(toolbarHeight: 0, elevation: 0),
|
||||
body: Stack(
|
||||
children: [
|
||||
// gradient background
|
||||
@ -412,13 +415,16 @@ class SearchBar extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Obx(
|
||||
() => Text(
|
||||
ctr!.defaultSearch.value,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: colorScheme.outline),
|
||||
() => Expanded(
|
||||
child: Text(
|
||||
ctr!.defaultSearch.value,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(color: colorScheme.outline),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -7,7 +7,7 @@ class HotController extends GetxController {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
final int _count = 20;
|
||||
int _currentPage = 1;
|
||||
RxList<HotVideoItemModel> videoList = [HotVideoItemModel()].obs;
|
||||
RxList<HotVideoItemModel> videoList = <HotVideoItemModel>[].obs;
|
||||
bool isLoadingMore = false;
|
||||
bool flag = false;
|
||||
OverlayEntry? popupDialog;
|
||||
|
@ -20,7 +20,7 @@ class MemberController extends GetxController {
|
||||
Box userInfoCache = GStrorage.userInfo;
|
||||
late int ownerMid;
|
||||
// 投稿列表
|
||||
RxList<VListItemModel>? archiveList = [VListItemModel()].obs;
|
||||
RxList<VListItemModel>? archiveList = <VListItemModel>[].obs;
|
||||
dynamic userInfo;
|
||||
RxInt attribute = (-1).obs;
|
||||
RxString attributeText = '关注'.obs;
|
||||
|
@ -15,7 +15,7 @@ class SSearchController extends GetxController {
|
||||
Box histiryWord = GStrorage.historyword;
|
||||
List historyCacheList = [];
|
||||
RxList historyList = [].obs;
|
||||
RxList<SearchSuggestItem> searchSuggestList = [SearchSuggestItem()].obs;
|
||||
RxList<SearchSuggestItem> searchSuggestList = <SearchSuggestItem>[].obs;
|
||||
final _debouncer =
|
||||
Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间
|
||||
String hintText = '搜索';
|
||||
|
88
lib/pages/setting/pages/play_gesture_set.dart
Normal file
88
lib/pages/setting/pages/play_gesture_set.dart
Normal file
@ -0,0 +1,88 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/utils/global_data.dart';
|
||||
|
||||
import '../../../models/common/gesture_mode.dart';
|
||||
import '../../../utils/storage.dart';
|
||||
import '../widgets/select_dialog.dart';
|
||||
import '../widgets/switch_item.dart';
|
||||
|
||||
class PlayGesturePage extends StatefulWidget {
|
||||
const PlayGesturePage({super.key});
|
||||
|
||||
@override
|
||||
State<PlayGesturePage> createState() => _PlayGesturePageState();
|
||||
}
|
||||
|
||||
class _PlayGesturePageState extends State<PlayGesturePage> {
|
||||
Box setting = GStrorage.setting;
|
||||
late int fullScreenGestureMode;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
fullScreenGestureMode = setting.get(SettingBoxKey.fullScreenGestureMode,
|
||||
defaultValue: FullScreenGestureMode.values.last.index);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TextStyle titleStyle = Theme.of(context).textTheme.titleMedium!;
|
||||
TextStyle subTitleStyle = Theme.of(context)
|
||||
.textTheme
|
||||
.labelMedium!
|
||||
.copyWith(color: Theme.of(context).colorScheme.outline);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: false,
|
||||
titleSpacing: 0,
|
||||
title: Text(
|
||||
'手势设置',
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('全屏手势', style: titleStyle),
|
||||
subtitle: Text(
|
||||
'通过手势快速进入全屏',
|
||||
style: subTitleStyle,
|
||||
),
|
||||
onTap: () async {
|
||||
String? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return SelectDialog<String>(
|
||||
title: '全屏手势',
|
||||
value: FullScreenGestureMode
|
||||
.values[fullScreenGestureMode].values,
|
||||
values: FullScreenGestureMode.values.map((e) {
|
||||
return {'title': e.labels, 'value': e.values};
|
||||
}).toList());
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
GlobalData().fullScreenGestureMode = FullScreenGestureMode
|
||||
.values
|
||||
.firstWhere((element) => element.values == result);
|
||||
fullScreenGestureMode =
|
||||
GlobalData().fullScreenGestureMode.index;
|
||||
setting.put(
|
||||
SettingBoxKey.fullScreenGestureMode, fullScreenGestureMode);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '双击快退/快进',
|
||||
subTitle: '左侧双击快退,右侧双击快进',
|
||||
setKey: SettingBoxKey.enableQuickDouble,
|
||||
defaultVal: true,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import 'package:pilipala/models/video/play/quality.dart';
|
||||
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:pilipala/plugin/pl_player/index.dart';
|
||||
import 'package:pilipala/services/service_locator.dart';
|
||||
import 'package:pilipala/utils/global_data.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
import 'widgets/switch_item.dart';
|
||||
@ -73,6 +74,12 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
title: Text('倍速设置', style: titleStyle),
|
||||
subtitle: Text('设置视频播放速度', style: subTitleStyle),
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
onTap: () => Get.toNamed('/playerGestureSet'),
|
||||
title: Text('手势设置', style: titleStyle),
|
||||
subtitle: Text('设置播放器手势', style: subTitleStyle),
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '开启1080P',
|
||||
subTitle: '免登录查看1080P视频',
|
||||
@ -134,18 +141,20 @@ class _PlaySettingState extends State<PlaySetting> {
|
||||
setKey: SettingBoxKey.enableAutoBrightness,
|
||||
defaultVal: false,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '双击快退/快进',
|
||||
subTitle: '左侧双击快退,右侧双击快进',
|
||||
setKey: SettingBoxKey.enableQuickDouble,
|
||||
defaultVal: true,
|
||||
),
|
||||
const SetSwitchItem(
|
||||
title: '弹幕开关',
|
||||
subTitle: '展示弹幕',
|
||||
setKey: SettingBoxKey.enableShowDanmaku,
|
||||
defaultVal: false,
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '控制栏动画',
|
||||
subTitle: '播放器控制栏显示动画效果',
|
||||
setKey: SettingBoxKey.enablePlayerControlAnimation,
|
||||
defaultVal: true,
|
||||
callFn: (bool val) {
|
||||
GlobalData().enablePlayerControlAnimation = val;
|
||||
}),
|
||||
ListTile(
|
||||
dense: false,
|
||||
title: Text('默认画质', style: titleStyle),
|
||||
|
@ -128,6 +128,7 @@ class VideoDetailController extends GetxController
|
||||
controller: plPlayerController,
|
||||
videoDetailCtr: this,
|
||||
floating: floating,
|
||||
bvid: bvid,
|
||||
);
|
||||
// CDN优化
|
||||
enableCDN = setting.get(SettingBoxKey.enableCDN, defaultValue: true);
|
||||
|
@ -22,8 +22,9 @@ import '../related/index.dart';
|
||||
import 'widgets/group_panel.dart';
|
||||
|
||||
class VideoIntroController extends GetxController {
|
||||
VideoIntroController({required this.bvid});
|
||||
// 视频bvid
|
||||
String bvid = Get.parameters['bvid']!;
|
||||
String bvid;
|
||||
|
||||
// 是否预渲染 骨架屏
|
||||
bool preRender = false;
|
||||
|
@ -24,7 +24,10 @@ import 'widgets/page.dart';
|
||||
import 'widgets/season.dart';
|
||||
|
||||
class VideoIntroPanel extends StatefulWidget {
|
||||
const VideoIntroPanel({super.key});
|
||||
final String bvid;
|
||||
final String? cid;
|
||||
|
||||
const VideoIntroPanel({super.key, required this.bvid, this.cid});
|
||||
|
||||
@override
|
||||
State<VideoIntroPanel> createState() => _VideoIntroPanelState();
|
||||
@ -47,7 +50,8 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
|
||||
/// fix 全屏时参数丢失
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||
videoIntroController =
|
||||
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
|
||||
_futureBuilderFuture = videoIntroController.queryVideoIntro();
|
||||
videoIntroController.videoDetail.listen((value) {
|
||||
videoDetail = value;
|
||||
@ -77,6 +81,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
loadingStatus: false,
|
||||
videoDetail: videoIntroController.videoDetail.value,
|
||||
heroTag: heroTag,
|
||||
bvid: widget.bvid,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
@ -95,6 +100,7 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
loadingStatus: true,
|
||||
videoDetail: videoDetail,
|
||||
heroTag: heroTag,
|
||||
bvid: widget.bvid,
|
||||
);
|
||||
}
|
||||
},
|
||||
@ -106,10 +112,15 @@ class VideoInfo extends StatefulWidget {
|
||||
final bool loadingStatus;
|
||||
final VideoDetailData? videoDetail;
|
||||
final String? heroTag;
|
||||
final String bvid;
|
||||
|
||||
const VideoInfo(
|
||||
{Key? key, this.loadingStatus = false, this.videoDetail, this.heroTag})
|
||||
: super(key: key);
|
||||
const VideoInfo({
|
||||
Key? key,
|
||||
this.loadingStatus = false,
|
||||
this.videoDetail,
|
||||
this.heroTag,
|
||||
required this.bvid,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<VideoInfo> createState() => _VideoInfoState();
|
||||
@ -149,7 +160,8 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
void initState() {
|
||||
super.initState();
|
||||
heroTag = widget.heroTag!;
|
||||
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||
videoIntroController =
|
||||
Get.put(VideoIntroController(bvid: widget.bvid), tag: heroTag);
|
||||
videoDetailCtr = Get.find<VideoDetailController>(tag: heroTag);
|
||||
videoItem = videoIntroController.videoItem!;
|
||||
sheetHeight = localCache.get('sheetHeight');
|
||||
|
@ -22,7 +22,7 @@ class VideoReplyController extends GetxController {
|
||||
String? replyLevel;
|
||||
// rpid 请求楼中楼回复
|
||||
String? rpid;
|
||||
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
||||
RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
|
||||
// 当前页
|
||||
int currentPage = 0;
|
||||
bool isLoadingMore = false;
|
||||
@ -62,6 +62,7 @@ class VideoReplyController extends GetxController {
|
||||
noMore.value = '';
|
||||
}
|
||||
if (noMore.value == '没有更多了') {
|
||||
isLoadingMore = false;
|
||||
return;
|
||||
}
|
||||
final res = await ReplyHttp.replyList(
|
||||
|
@ -134,13 +134,13 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
|
||||
super.build(context);
|
||||
return RefreshIndicator(
|
||||
onRefresh: () async {
|
||||
_videoReplyController.currentPage = 0;
|
||||
return await _videoReplyController.queryReplyList();
|
||||
return await _videoReplyController.queryReplyList(type: 'init');
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
CustomScrollView(
|
||||
controller: scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
key: const PageStorageKey<String>('评论'),
|
||||
slivers: <Widget>[
|
||||
SliverPersistentHeader(
|
||||
|
@ -462,6 +462,9 @@ class ReplyItemRow extends StatelessWidget {
|
||||
|
||||
InlineSpan buildContent(
|
||||
BuildContext context, replyItem, replyReply, fReplyItem) {
|
||||
final String routePath = Get.currentRoute;
|
||||
bool isVideoPage = routePath.startsWith('/video');
|
||||
|
||||
// replyItem 当前回复内容
|
||||
// replyReply 查看二楼回复(回复详情)回调
|
||||
// fReplyItem 父级回复内容,用作二楼回复(回复详情)展示
|
||||
@ -503,21 +506,25 @@ InlineSpan buildContent(
|
||||
.replaceAll('"', '"')
|
||||
.replaceAll(''', "'")
|
||||
.replaceAll(' ', ' ');
|
||||
// print("content.jumpUrl.keys:" + content.jumpUrl.keys.toString());
|
||||
// 构建正则表达式
|
||||
final List<String> specialTokens = [
|
||||
...content.emote.keys,
|
||||
...content.topicsMeta?.keys?.map((e) => '#$e#') ?? [],
|
||||
...content.atNameToMid.keys.map((e) => '@$e'),
|
||||
...content.jumpUrl.keys.map((e) =>
|
||||
e.replaceAll('?', '\\?').replaceAll('+', '\\+').replaceAll('*', '\\*')),
|
||||
];
|
||||
List<dynamic> jumpUrlKeysList = content.jumpUrl.keys.map((e) {
|
||||
return e.replaceAllMapped(
|
||||
RegExp(r'[?+*]'), (match) => '\\${match.group(0)}');
|
||||
}).toList();
|
||||
|
||||
String patternStr = specialTokens.map(RegExp.escape).join('|');
|
||||
if (patternStr.isNotEmpty) {
|
||||
patternStr += "|";
|
||||
}
|
||||
patternStr += r'(\b(?:\d+[::])?[0-5]?[0-9][::][0-5]?[0-9]\b)';
|
||||
if (jumpUrlKeysList.isNotEmpty) {
|
||||
patternStr += '|${jumpUrlKeysList.join('|')}';
|
||||
}
|
||||
final RegExp pattern = RegExp(patternStr);
|
||||
List<String> matchedStrs = [];
|
||||
void addPlainTextSpan(str) {
|
||||
@ -571,27 +578,31 @@ InlineSpan buildContent(
|
||||
spanChilds.add(
|
||||
TextSpan(
|
||||
text: ' $matchStr ',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
style: isVideoPage
|
||||
? TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
)
|
||||
: null,
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
// 跳转到指定位置
|
||||
try {
|
||||
SmartDialog.showToast('跳转至:$matchStr');
|
||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
|
||||
.plPlayerController
|
||||
.seekTo(
|
||||
Duration(seconds: Utils.duration(matchStr)),
|
||||
);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('跳转失败: $e');
|
||||
if (isVideoPage) {
|
||||
try {
|
||||
SmartDialog.showToast('跳转至:$matchStr');
|
||||
Get.find<VideoDetailController>(
|
||||
tag: Get.arguments['heroTag'])
|
||||
.plPlayerController
|
||||
.seekTo(
|
||||
Duration(seconds: Utils.duration(matchStr)),
|
||||
);
|
||||
} catch (e) {
|
||||
SmartDialog.showToast('跳转失败: $e');
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
print("matchStr=$matchStr");
|
||||
String appUrlSchema = '';
|
||||
final bool enableWordRe = setting.get(SettingBoxKey.enableWordRe,
|
||||
defaultValue: false) as bool;
|
||||
|
@ -109,21 +109,26 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
||||
@override
|
||||
void didChangeMetrics() {
|
||||
super.didChangeMetrics();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 键盘高度
|
||||
final viewInsets = EdgeInsets.fromViewPadding(
|
||||
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
||||
_debouncer.run(() {
|
||||
if (mounted) {
|
||||
if (keyboardHeight == 0 && emoteHeight == 0) {
|
||||
setState(() {
|
||||
emoteHeight = keyboardHeight =
|
||||
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
||||
});
|
||||
final String routePath = Get.currentRoute;
|
||||
if (mounted &&
|
||||
(routePath.startsWith('/video') ||
|
||||
routePath.startsWith('/dynamicDetail'))) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 键盘高度
|
||||
final viewInsets = EdgeInsets.fromViewPadding(
|
||||
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
||||
_debouncer.run(() {
|
||||
if (mounted) {
|
||||
if (keyboardHeight == 0 && emoteHeight == 0) {
|
||||
setState(() {
|
||||
emoteHeight = keyboardHeight =
|
||||
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -131,11 +136,15 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
_replyContentController.dispose();
|
||||
replyContentFocusNode.removeListener(() {});
|
||||
replyContentFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double keyboardHeight = EdgeInsets.fromViewPadding(
|
||||
View.of(context).viewInsets, View.of(context).devicePixelRatio)
|
||||
.bottom;
|
||||
return Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
|
@ -12,7 +12,7 @@ class VideoReplyReplyController extends GetxController {
|
||||
// rpid 请求楼中楼回复
|
||||
String? rpid;
|
||||
ReplyType replyType = ReplyType.video;
|
||||
RxList<ReplyItemModel> replyList = [ReplyItemModel()].obs;
|
||||
RxList<ReplyItemModel> replyList = <ReplyItemModel>[].obs;
|
||||
// 当前页
|
||||
int currentPage = 0;
|
||||
bool isLoadingMore = false;
|
||||
|
@ -23,7 +23,6 @@ import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:pilipala/services/service_locator.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
|
||||
import 'package:pilipala/plugin/pl_player/utils/fullscreen.dart';
|
||||
import '../../../services/shutdown_timer_service.dart';
|
||||
import 'widgets/header_control.dart';
|
||||
|
||||
@ -68,7 +67,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
super.initState();
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
videoDetailController = Get.put(VideoDetailController(), tag: heroTag);
|
||||
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||
videoIntroController = Get.put(
|
||||
VideoIntroController(bvid: Get.parameters['bvid']!),
|
||||
tag: heroTag);
|
||||
videoIntroController.videoDetail.listen((value) {
|
||||
videoPlayerServiceHandler.onVideoDetailChange(
|
||||
value, videoDetailController.cid.value);
|
||||
@ -227,6 +228,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
plPlayerController!.removeStatusLister(playerListener);
|
||||
plPlayerController!.pause();
|
||||
}
|
||||
print('🐶🐶');
|
||||
setState(() => isShowing = false);
|
||||
super.didPushNext();
|
||||
}
|
||||
@ -550,7 +552,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
slivers: <Widget>[
|
||||
if (videoDetailController.videoType ==
|
||||
SearchType.video) ...[
|
||||
const VideoIntroPanel(),
|
||||
VideoIntroPanel(
|
||||
bvid: videoDetailController.bvid),
|
||||
] else if (videoDetailController.videoType ==
|
||||
SearchType.media_bangumi) ...[
|
||||
Obx(() => BangumiIntroPanel(
|
||||
@ -577,7 +580,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
.withOpacity(0.06),
|
||||
),
|
||||
),
|
||||
RelatedVideoPanel(),
|
||||
const RelatedVideoPanel(),
|
||||
],
|
||||
);
|
||||
},
|
||||
@ -627,6 +630,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
||||
headerControl: HeaderControl(
|
||||
controller: plPlayerController,
|
||||
videoDetailCtr: videoDetailController,
|
||||
bvid: videoDetailController.bvid,
|
||||
),
|
||||
danmuWidget: Obx(
|
||||
() => PlDanmaku(
|
||||
|
@ -27,11 +27,13 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||
this.controller,
|
||||
this.videoDetailCtr,
|
||||
this.floating,
|
||||
this.bvid,
|
||||
super.key,
|
||||
});
|
||||
final PlPlayerController? controller;
|
||||
final VideoDetailController? videoDetailCtr;
|
||||
final Floating? floating;
|
||||
final String? bvid;
|
||||
|
||||
@override
|
||||
State<HeaderControl> createState() => _HeaderControlState();
|
||||
@ -62,7 +64,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
speedsList = widget.controller!.speedsList;
|
||||
fullScreenStatusListener();
|
||||
heroTag = Get.arguments['heroTag'];
|
||||
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||
videoIntroController =
|
||||
Get.put(VideoIntroController(bvid: widget.bvid!), tag: heroTag);
|
||||
}
|
||||
|
||||
void fullScreenStatusListener() {
|
||||
|
@ -51,27 +51,31 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
|
||||
@override
|
||||
void didChangeMetrics() {
|
||||
super.didChangeMetrics();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 键盘高度
|
||||
final viewInsets = EdgeInsets.fromViewPadding(
|
||||
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
||||
_debouncer.run(() {
|
||||
if (mounted) {
|
||||
if (keyboardHeight == 0) {
|
||||
setState(() {
|
||||
emoteHeight = keyboardHeight =
|
||||
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
||||
});
|
||||
final String routePath = Get.currentRoute;
|
||||
if (mounted && routePath.startsWith('/whisper_detail')) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 键盘高度
|
||||
final viewInsets = EdgeInsets.fromViewPadding(
|
||||
View.of(context).viewInsets, View.of(context).devicePixelRatio);
|
||||
_debouncer.run(() {
|
||||
if (mounted) {
|
||||
if (keyboardHeight == 0) {
|
||||
setState(() {
|
||||
emoteHeight = keyboardHeight =
|
||||
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
replyContentFocusNode.removeListener(() {});
|
||||
replyContentFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import 'package:hive/hive.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart';
|
||||
import 'package:nil/nil.dart';
|
||||
import 'package:pilipala/models/common/gesture_mode.dart';
|
||||
import 'package:pilipala/plugin/pl_player/controller.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/duration.dart';
|
||||
import 'package:pilipala/plugin/pl_player/models/fullscreen_mode.dart';
|
||||
@ -17,6 +18,7 @@ import 'package:pilipala/utils/feed_back.dart';
|
||||
import 'package:pilipala/utils/storage.dart';
|
||||
import 'package:screen_brightness/screen_brightness.dart';
|
||||
|
||||
import '../../utils/global_data.dart';
|
||||
import 'models/bottom_progress_behavior.dart';
|
||||
import 'widgets/app_bar_ani.dart';
|
||||
import 'widgets/backward_seek.dart';
|
||||
@ -73,6 +75,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
late bool enableQuickDouble;
|
||||
late bool enableBackgroundPlay;
|
||||
late double screenWidth;
|
||||
final FullScreenGestureMode fullScreenGestureMode =
|
||||
GlobalData().fullScreenGestureMode;
|
||||
|
||||
// 用于记录上一次全屏切换手势触发时间,避免误触
|
||||
DateTime? lastFullScreenToggleTime;
|
||||
@ -116,7 +120,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
super.initState();
|
||||
screenWidth = Get.size.width;
|
||||
animationController = AnimationController(
|
||||
vsync: this, duration: const Duration(milliseconds: 300));
|
||||
vsync: this,
|
||||
duration: GlobalData().enablePlayerControlAnimation
|
||||
? const Duration(milliseconds: 150)
|
||||
: const Duration(milliseconds: 10),
|
||||
);
|
||||
videoController = widget.controller.videoController!;
|
||||
widget.controller.headerControl = widget.headerControl;
|
||||
widget.controller.bottomControl = widget.bottomControl;
|
||||
@ -520,18 +528,20 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
// 全屏
|
||||
final double dy = details.delta.dy;
|
||||
const double threshold = 7.0; // 滑动阈值
|
||||
final bool flag =
|
||||
fullScreenGestureMode != FullScreenGestureMode.values.last;
|
||||
if (dy > _distance && dy > threshold) {
|
||||
if (_.isFullScreen.value) {
|
||||
if (_.isFullScreen.value ^ flag) {
|
||||
lastFullScreenToggleTime = DateTime.now();
|
||||
// 下滑退出全屏
|
||||
await widget.controller.triggerFullScreen(status: false);
|
||||
await widget.controller.triggerFullScreen(status: flag);
|
||||
}
|
||||
_distance = 0.0;
|
||||
} else if (dy < _distance && dy < -threshold) {
|
||||
if (!_.isFullScreen.value) {
|
||||
if (!_.isFullScreen.value ^ flag) {
|
||||
lastFullScreenToggleTime = DateTime.now();
|
||||
// 上滑进入全屏
|
||||
await widget.controller.triggerFullScreen();
|
||||
await widget.controller.triggerFullScreen(status: !flag);
|
||||
}
|
||||
_distance = 0.0;
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ class AppBarAni extends StatelessWidget implements PreferredSizeWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
visible ? controller.reverse() : controller.forward();
|
||||
visible ? controller.forward() : controller.reverse();
|
||||
return SlideTransition(
|
||||
position: Tween<Offset>(
|
||||
begin: Offset.zero,
|
||||
end: Offset(0, position! == 'top' ? -1 : 1),
|
||||
begin: Offset(0, position! == 'top' ? -1 : 1),
|
||||
end: Offset.zero,
|
||||
).animate(CurvedAnimation(
|
||||
parent: controller,
|
||||
curve: Curves.linear,
|
||||
|
@ -39,6 +39,7 @@ import '../pages/setting/pages/color_select.dart';
|
||||
import '../pages/setting/pages/display_mode.dart';
|
||||
import '../pages/setting/pages/font_size_select.dart';
|
||||
import '../pages/setting/pages/home_tabbar_set.dart';
|
||||
import '../pages/setting/pages/play_gesture_set.dart';
|
||||
import '../pages/setting/pages/play_speed_set.dart';
|
||||
import '../pages/setting/recommend_setting.dart';
|
||||
import '../pages/setting/play_setting.dart';
|
||||
@ -166,6 +167,9 @@ class Routes {
|
||||
CustomGetPage(name: '/subscription', page: () => const SubPage()),
|
||||
// 订阅详情
|
||||
CustomGetPage(name: '/subDetail', page: () => const SubDetailPage()),
|
||||
// 播放器手势
|
||||
CustomGetPage(
|
||||
name: '/playerGestureSet', page: () => const PlayGesturePage()),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,8 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler {
|
||||
));
|
||||
if (_item.isNotEmpty) {
|
||||
_item.removeLast();
|
||||
}
|
||||
if (_item.isNotEmpty) {
|
||||
setMediaItem(_item.last);
|
||||
}
|
||||
if (_item.isEmpty) {
|
||||
|
@ -1,5 +1,10 @@
|
||||
import '../models/common/index.dart';
|
||||
|
||||
class GlobalData {
|
||||
int imgQuality = 10;
|
||||
FullScreenGestureMode fullScreenGestureMode =
|
||||
FullScreenGestureMode.values.last;
|
||||
bool enablePlayerControlAnimation = true;
|
||||
|
||||
// 私有构造函数
|
||||
GlobalData._();
|
||||
|
@ -4,6 +4,7 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:pilipala/models/model_owner.dart';
|
||||
import 'package:pilipala/models/search/hot.dart';
|
||||
import 'package:pilipala/models/user/info.dart';
|
||||
import '../models/common/gesture_mode.dart';
|
||||
import 'global_data.dart';
|
||||
|
||||
class GStrorage {
|
||||
@ -45,6 +46,11 @@ class GStrorage {
|
||||
video = await Hive.openBox('video');
|
||||
GlobalData().imgQuality =
|
||||
setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10); // 设置全局变量
|
||||
GlobalData().fullScreenGestureMode = FullScreenGestureMode.values[
|
||||
setting.get(SettingBoxKey.fullScreenGestureMode,
|
||||
defaultValue: FullScreenGestureMode.values.last.index) as int];
|
||||
GlobalData().enablePlayerControlAnimation = setting
|
||||
.get(SettingBoxKey.enablePlayerControlAnimation, defaultValue: true);
|
||||
}
|
||||
|
||||
static void regAdapter() {
|
||||
@ -94,11 +100,13 @@ class SettingBoxKey {
|
||||
enableCDN = 'enableCDN',
|
||||
autoPiP = 'autoPiP',
|
||||
enableAutoLongPressSpeed = 'enableAutoLongPressSpeed',
|
||||
enablePlayerControlAnimation = 'enablePlayerControlAnimation',
|
||||
|
||||
// youtube 双击快进快退
|
||||
enableQuickDouble = 'enableQuickDouble',
|
||||
enableShowDanmaku = 'enableShowDanmaku',
|
||||
enableBackgroundPlay = 'enableBackgroundPlay',
|
||||
fullScreenGestureMode = 'fullScreenGestureMode',
|
||||
|
||||
/// 隐私
|
||||
blackMidsList = 'blackMidsList',
|
||||
|
Reference in New Issue
Block a user