Merge branch 'main' into design
This commit is contained in:
@ -626,4 +626,7 @@ class Api {
|
||||
/// 修复标题和海报
|
||||
// /api/view?id=${aid} /all/video/av${aid} /video/av${aid}/
|
||||
static const String fixTitleAndPic = '${HttpString.biliplusBaseUrl}/api/view';
|
||||
|
||||
/// 专栏详情
|
||||
static const String opusDetail = '/x/polymer/web-dynamic/v1/opus/detail';
|
||||
}
|
||||
|
||||
@ -215,4 +215,25 @@ class DynamicsHttp {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static Future opusDetail({
|
||||
required int opusId,
|
||||
}) async {
|
||||
var res = await Request().get(
|
||||
Api.opusDetail,
|
||||
data: {'id': opusId},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'data': [],
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,6 +216,21 @@ class BuildMainApp extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Box setting = GStorage.setting;
|
||||
|
||||
/// 纯黑模式主题配置
|
||||
ColorScheme? pureDarkColorScheme;
|
||||
final bool enablePureBlack =
|
||||
setting.get(SettingBoxKey.enablePureBlack, defaultValue: false);
|
||||
if (enablePureBlack) {
|
||||
pureDarkColorScheme = darkColorScheme.copyWith(
|
||||
background: Colors.black,
|
||||
surface: Colors.black,
|
||||
onPrimary: Colors.black,
|
||||
onSecondary: Colors.black,
|
||||
);
|
||||
}
|
||||
|
||||
final SnackBarThemeData snackBarTheme = SnackBarThemeData(
|
||||
actionTextColor: lightColorScheme.primary,
|
||||
backgroundColor: lightColorScheme.secondaryContainer,
|
||||
@ -255,13 +270,13 @@ class BuildMainApp extends StatelessWidget {
|
||||
title: 'PiliPala',
|
||||
theme: buildThemeData(
|
||||
currentThemeValue == ThemeType.dark
|
||||
? darkColorScheme
|
||||
? pureDarkColorScheme ?? darkColorScheme
|
||||
: lightColorScheme,
|
||||
),
|
||||
darkTheme: buildThemeData(
|
||||
currentThemeValue == ThemeType.light
|
||||
? lightColorScheme
|
||||
: darkColorScheme,
|
||||
: pureDarkColorScheme ?? darkColorScheme,
|
||||
),
|
||||
localizationsDelegates: const [
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:pilipala/http/html.dart';
|
||||
import 'package:pilipala/http/dynamics.dart';
|
||||
import 'package:pilipala/http/reply.dart';
|
||||
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||
import 'package:pilipala/models/video/reply/item.dart';
|
||||
@ -12,6 +12,7 @@ class DynamicDetailController extends GetxController {
|
||||
DynamicDetailController(this.oid, this.type);
|
||||
int? oid;
|
||||
int? type;
|
||||
int? opusId;
|
||||
dynamic item;
|
||||
int? floor;
|
||||
String nextOffset = "";
|
||||
@ -56,6 +57,12 @@ class DynamicDetailController extends GetxController {
|
||||
if (reqType == 'init') {
|
||||
nextOffset = '';
|
||||
noMore.value = '';
|
||||
if (opusId != null && oid == 0) {
|
||||
var res = await DynamicsHttp.opusDetail(opusId: opusId!);
|
||||
if (res['status']) {
|
||||
oid = int.parse(res['data']['item']['basic']['comment_id_str']);
|
||||
}
|
||||
}
|
||||
}
|
||||
var res = await ReplyHttp.replyList(
|
||||
oid: oid!,
|
||||
@ -110,15 +117,12 @@ class DynamicDetailController extends GetxController {
|
||||
sortTypeTitle.value = _sortType.titles;
|
||||
sortTypeLabel.value = _sortType.labels;
|
||||
replyList.clear();
|
||||
noMore.value = '';
|
||||
isLoadingMore = false;
|
||||
isEnd = false;
|
||||
queryReplyList(reqType: 'init');
|
||||
}
|
||||
|
||||
// 根据jumpUrl获取动态html
|
||||
reqHtmlByOpusId(int id) async {
|
||||
var res = await HtmlHttp.reqHtml(id, 'opus');
|
||||
oid = res['commentId'];
|
||||
}
|
||||
|
||||
// 上拉加载
|
||||
Future onLoad() async {
|
||||
queryReplyList(reqType: 'onLoad');
|
||||
|
||||
@ -89,9 +89,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
||||
_dynamicDetailController = Get.put(
|
||||
DynamicDetailController(oid, replyType),
|
||||
tag: opusId.toString());
|
||||
_dynamicDetailController.opusId = opusId;
|
||||
_futureBuilderFuture = _dynamicDetailController.queryReplyList();
|
||||
await _dynamicDetailController.reqHtmlByOpusId(opusId!);
|
||||
setState(() {});
|
||||
}
|
||||
} else {
|
||||
oid = moduleDynamic.major!.draw!.id!;
|
||||
|
||||
@ -110,7 +110,8 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final isPortrait = mediaQuery.orientation == Orientation.portrait;
|
||||
final isLandscape = mediaQuery.orientation == Orientation.landscape;
|
||||
final RxBool isLandscape =
|
||||
(mediaQuery.orientation == Orientation.landscape).obs;
|
||||
|
||||
final padding = mediaQuery.padding;
|
||||
|
||||
@ -194,7 +195,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
Obx(
|
||||
() => SizedBox(
|
||||
height: padding.top +
|
||||
(_liveRoomController.isPortrait.value || isLandscape
|
||||
(_liveRoomController.isPortrait.value || isLandscape.value
|
||||
? 0
|
||||
: kToolbarHeight),
|
||||
),
|
||||
@ -205,14 +206,14 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
if (plPlayerController.isFullScreen.value == true) {
|
||||
plPlayerController.triggerFullScreen(status: false);
|
||||
}
|
||||
if (isLandscape) {
|
||||
if (isLandscape.value) {
|
||||
verticalScreen();
|
||||
}
|
||||
},
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: Get.size.width,
|
||||
height: isLandscape
|
||||
height: isLandscape.value
|
||||
? Get.size.height
|
||||
: !_liveRoomController.isPortrait.value
|
||||
? Get.size.width * 9 / 16
|
||||
@ -313,7 +314,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
),
|
||||
// 消息列表
|
||||
Visibility(
|
||||
visible: !isLandscape,
|
||||
visible: !isLandscape.value,
|
||||
child: Obx(
|
||||
() => Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
|
||||
@ -249,6 +249,15 @@ class _StyleSettingState extends State<StyleSetting> {
|
||||
'当前模式:${settingController.themeType.value.description}',
|
||||
style: subTitleStyle)),
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '纯黑模式',
|
||||
subTitle: '深色模式时使用纯黑色背景,适用于OLED屏幕',
|
||||
setKey: SettingBoxKey.enablePureBlack,
|
||||
defaultVal: false,
|
||||
callFn: (bool val) => {
|
||||
if (val && Get.isDarkMode) {Get.appUpdate()}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
dense: false,
|
||||
onTap: () => settingController.setDynamicBadgeMode(context),
|
||||
|
||||
@ -73,7 +73,7 @@ class VideoReplyController extends GetxController {
|
||||
/// 临时修复
|
||||
final bool flag = replyList
|
||||
.any((ReplyItemModel reply) => reply.rpid == replies.first.rpid);
|
||||
if (replies.length == 1 && flag) {
|
||||
if (replies.length == 1 && flag && type == 'onLoad') {
|
||||
replies.clear();
|
||||
isEnd = true;
|
||||
}
|
||||
|
||||
@ -1068,13 +1068,10 @@ class _HeaderControlState extends State<HeaderControl> {
|
||||
);
|
||||
final bool isLandscape =
|
||||
MediaQuery.of(context).orientation == Orientation.landscape;
|
||||
return AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
foregroundColor: Colors.white,
|
||||
primary: false,
|
||||
automaticallyImplyLeading: false,
|
||||
titleSpacing: 14,
|
||||
title: Column(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (isFullScreen.value && isLandscape) ...[
|
||||
Row(
|
||||
|
||||
@ -443,7 +443,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
);
|
||||
return Stack(
|
||||
return ClipRect(
|
||||
child: Stack(
|
||||
fit: StackFit.passthrough,
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
@ -719,7 +720,8 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
_brightnessValue.value - delta / level;
|
||||
final double result = brightness.clamp(0.0, 1.0);
|
||||
setBrightness(result);
|
||||
} else if (isUsingFullScreenGestures(tapPosition, sectionWidth)) {
|
||||
} else if (isUsingFullScreenGestures(
|
||||
tapPosition, sectionWidth)) {
|
||||
// 全屏
|
||||
final double dy = details.delta.dy;
|
||||
const double threshold = 7.0; // 滑动阈值
|
||||
@ -732,7 +734,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
lastFullScreenToggleTime = DateTime.now();
|
||||
// 下滑退出全屏
|
||||
await widget.controller.triggerFullScreen(status: flag);
|
||||
widget.fullScreenCb?.call(flag);
|
||||
}
|
||||
_distance.value = 0.0;
|
||||
} else if (dy < _distance.value &&
|
||||
@ -742,7 +743,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
lastFullScreenToggleTime = DateTime.now();
|
||||
// 上滑进入全屏
|
||||
await widget.controller.triggerFullScreen(status: !flag);
|
||||
widget.fullScreenCb?.call(!flag);
|
||||
}
|
||||
_distance.value = 0.0;
|
||||
}
|
||||
@ -770,9 +770,9 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
() => Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
if (widget.headerControl != null || _.headerControl != null) ...[
|
||||
if (widget.headerControl != null ||
|
||||
_.headerControl != null) ...[
|
||||
Flexible(
|
||||
child: ClipRect(
|
||||
child: AppBarAni(
|
||||
controller: animationController,
|
||||
visible: !_.controlsLock.value && _.showControls.value,
|
||||
@ -780,13 +780,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
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,
|
||||
@ -799,7 +797,6 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -934,6 +931,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
onSubmittedcb: _handleSubmittedCallback,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,19 +18,18 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
height: 90,
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(7, 0, 7, 6),
|
||||
padding: const EdgeInsets.fromLTRB(7, 0, 7, 4),
|
||||
child: ProgressBarWidget(controller: controller!),
|
||||
),
|
||||
Row(children: buildBottomControl!),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -137,7 +137,8 @@ class SettingBoxKey {
|
||||
enableGradientBg = 'enableGradientBg',
|
||||
enableDynamicSwitch = 'enableDynamicSwitch',
|
||||
navBarSort = 'navBarSort',
|
||||
actionTypeSort = 'actionTypeSort';
|
||||
actionTypeSort = 'actionTypeSort',
|
||||
enablePureBlack = 'enablePureBlack';
|
||||
}
|
||||
|
||||
class LocalCacheKey {
|
||||
|
||||
Reference in New Issue
Block a user