Merge branch 'guozhigq:main' into refactor-danmaku_controller
This commit is contained in:
@ -97,8 +97,8 @@ class Api {
|
|||||||
// 操作用户关系
|
// 操作用户关系
|
||||||
static const String relationMod = '/x/relation/modify';
|
static const String relationMod = '/x/relation/modify';
|
||||||
|
|
||||||
// 相互关系查询
|
// 相互关系查询 // 失效
|
||||||
static const String relationSearch = '/x/space/wbi/acc/relation';
|
// static const String relationSearch = '/x/space/wbi/acc/relation';
|
||||||
|
|
||||||
// 评论列表
|
// 评论列表
|
||||||
// https://api.bilibili.com/x/v2/reply/main?csrf=6e22efc1a47225ea25f901f922b5cfdd&mode=3&oid=254175381&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=0&type=11
|
// https://api.bilibili.com/x/v2/reply/main?csrf=6e22efc1a47225ea25f901f922b5cfdd&mode=3&oid=254175381&pagination_str=%7B%22offset%22:%22%22%7D&plat=1&seek_rpid=0&type=11
|
||||||
|
|||||||
@ -250,31 +250,43 @@ class UserHttp {
|
|||||||
return {'status': false, 'msg': res.data['message']};
|
return {'status': false, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static Future hasFollow(int mid) async {
|
||||||
// 相互关系查询
|
|
||||||
static Future relationSearch(int mid) async {
|
|
||||||
Map params = await WbiSign().makSign({
|
|
||||||
'mid': mid,
|
|
||||||
'token': '',
|
|
||||||
'platform': 'web',
|
|
||||||
'web_location': 1550101,
|
|
||||||
});
|
|
||||||
var res = await Request().get(
|
var res = await Request().get(
|
||||||
Api.relationSearch,
|
Api.hasFollow,
|
||||||
data: {
|
data: {
|
||||||
'mid': mid,
|
'fid': mid,
|
||||||
'w_rid': params['w_rid'],
|
|
||||||
'wts': params['wts'],
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
// relation 主动状态
|
|
||||||
// 被动状态
|
|
||||||
return {'status': true, 'data': res.data['data']};
|
return {'status': true, 'data': res.data['data']};
|
||||||
} else {
|
} else {
|
||||||
return {'status': false, 'msg': res.data['message']};
|
return {'status': false, 'msg': res.data['message']};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// // 相互关系查询
|
||||||
|
// static Future relationSearch(int mid) async {
|
||||||
|
// Map params = await WbiSign().makSign({
|
||||||
|
// 'mid': mid,
|
||||||
|
// 'token': '',
|
||||||
|
// 'platform': 'web',
|
||||||
|
// 'web_location': 1550101,
|
||||||
|
// });
|
||||||
|
// var res = await Request().get(
|
||||||
|
// Api.relationSearch,
|
||||||
|
// data: {
|
||||||
|
// 'mid': mid,
|
||||||
|
// 'w_rid': params['w_rid'],
|
||||||
|
// 'wts': params['wts'],
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// if (res.data['code'] == 0) {
|
||||||
|
// // relation 主动状态
|
||||||
|
// // 被动状态
|
||||||
|
// return {'status': true, 'data': res.data['data']};
|
||||||
|
// } else {
|
||||||
|
// return {'status': false, 'msg': res.data['message']};
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// 搜索历史记录
|
// 搜索历史记录
|
||||||
static Future searchHistory(
|
static Future searchHistory(
|
||||||
|
|||||||
@ -116,16 +116,28 @@ class MemberController extends GetxController {
|
|||||||
Future relationSearch() async {
|
Future relationSearch() async {
|
||||||
if (userInfo == null) return;
|
if (userInfo == null) return;
|
||||||
if (mid == ownerMid) return;
|
if (mid == ownerMid) return;
|
||||||
var res = await UserHttp.relationSearch(mid);
|
var res = await UserHttp.hasFollow(mid);
|
||||||
if (res['status']) {
|
if (res['status']) {
|
||||||
attribute.value = res['data']['relation']['attribute'];
|
attribute.value = res['data']['attribute'];
|
||||||
attributeText.value = attribute.value == 0
|
switch (attribute.value) {
|
||||||
? '关注'
|
case 1:
|
||||||
: attribute.value == 2
|
attributeText.value = '悄悄关注';
|
||||||
? '已关注'
|
break;
|
||||||
: attribute.value == 6
|
case 2:
|
||||||
? '已互粉'
|
attributeText.value = '已关注';
|
||||||
: '已拉黑';
|
break;
|
||||||
|
case 6:
|
||||||
|
attributeText.value = '已互关';
|
||||||
|
break;
|
||||||
|
case 128:
|
||||||
|
attributeText.value = '已拉黑';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
attributeText.value = '关注';
|
||||||
|
}
|
||||||
|
if (res['data']['special'] == 1) {
|
||||||
|
attributeText.value += 'SP';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -237,17 +237,17 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
final double pinnedHeaderHeight =
|
final double pinnedHeaderHeight =
|
||||||
statusBarHeight + kToolbarHeight + videoHeight;
|
statusBarHeight + kToolbarHeight + videoHeight;
|
||||||
if (MediaQuery.of(context).orientation == Orientation.landscape ||
|
if (MediaQuery.of(context).orientation == Orientation.landscape ||
|
||||||
plPlayerController!.isFullScreen.value) {
|
plPlayerController?.isFullScreen.value == true) {
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
} else {
|
} else {
|
||||||
exitFullScreen();
|
exitFullScreen();
|
||||||
}
|
}
|
||||||
Widget childWhenDisabled = SafeArea(
|
Widget childWhenDisabled = SafeArea(
|
||||||
top: MediaQuery.of(context).orientation == Orientation.portrait,
|
top: MediaQuery.of(context).orientation == Orientation.portrait,
|
||||||
bottom: MediaQuery.of(context).orientation == Orientation.portrait
|
bottom: MediaQuery.of(context).orientation == Orientation.portrait &&
|
||||||
&& plPlayerController!.isFullScreen.value,
|
plPlayerController?.isFullScreen.value == true,
|
||||||
left: !plPlayerController!.isFullScreen.value,
|
left: plPlayerController?.isFullScreen.value != true,
|
||||||
right: !plPlayerController!.isFullScreen.value,
|
right: plPlayerController?.isFullScreen.value != true,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Scaffold(
|
Scaffold(
|
||||||
@ -259,169 +259,168 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
headerSliverBuilder:
|
headerSliverBuilder:
|
||||||
(BuildContext context, bool innerBoxIsScrolled) {
|
(BuildContext context, bool innerBoxIsScrolled) {
|
||||||
return <Widget>[
|
return <Widget>[
|
||||||
Obx(() => PopScope(
|
SliverAppBar(
|
||||||
canPop: !plPlayerController!.isFullScreen.value,
|
automaticallyImplyLeading: false,
|
||||||
onPopInvoked: (bool didPop) {
|
pinned: false,
|
||||||
if (plPlayerController!.isFullScreen.value) {
|
elevation: 0,
|
||||||
plPlayerController!
|
scrolledUnderElevation: 0,
|
||||||
.triggerFullScreen(status: false);
|
forceElevated: innerBoxIsScrolled,
|
||||||
}
|
expandedHeight:
|
||||||
if (MediaQuery.of(context).orientation ==
|
plPlayerController?.isFullScreen.value == true ||
|
||||||
Orientation.landscape) {
|
MediaQuery.of(context).orientation ==
|
||||||
verticalScreen();
|
Orientation.landscape
|
||||||
}
|
? MediaQuery.of(context).size.height -
|
||||||
},
|
(MediaQuery.of(context).orientation ==
|
||||||
child: SliverAppBar(
|
Orientation.landscape
|
||||||
automaticallyImplyLeading: false,
|
? 0
|
||||||
pinned: false,
|
: statusBarHeight)
|
||||||
elevation: 0,
|
: videoHeight,
|
||||||
scrolledUnderElevation: 0,
|
backgroundColor: Colors.black,
|
||||||
forceElevated: innerBoxIsScrolled,
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
expandedHeight:
|
background: PopScope(
|
||||||
plPlayerController!.isFullScreen.value ||
|
canPop:
|
||||||
MediaQuery.of(context).orientation ==
|
plPlayerController?.isFullScreen.value != true,
|
||||||
Orientation.landscape
|
onPopInvoked: (bool didPop) {
|
||||||
? MediaQuery.of(context).size.height -
|
if (plPlayerController?.isFullScreen.value ==
|
||||||
(MediaQuery.of(context).orientation ==
|
true) {
|
||||||
Orientation.landscape
|
plPlayerController!
|
||||||
? 0
|
.triggerFullScreen(status: false);
|
||||||
: statusBarHeight)
|
}
|
||||||
: videoHeight,
|
if (MediaQuery.of(context).orientation ==
|
||||||
backgroundColor: Colors.black,
|
Orientation.landscape) {
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
verticalScreen();
|
||||||
background: LayoutBuilder(
|
}
|
||||||
builder: (context, boxConstraints) {
|
},
|
||||||
double maxWidth = boxConstraints.maxWidth;
|
child: LayoutBuilder(
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
builder: (context, boxConstraints) {
|
||||||
return Stack(
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
children: [
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
FutureBuilder(
|
return Stack(
|
||||||
future: _futureBuilderFuture,
|
children: [
|
||||||
builder: ((context, snapshot) {
|
FutureBuilder(
|
||||||
if (snapshot.hasData &&
|
future: _futureBuilderFuture,
|
||||||
snapshot.data['status']) {
|
builder: ((context, snapshot) {
|
||||||
return Obx(
|
if (snapshot.hasData &&
|
||||||
() => !videoDetailController
|
snapshot.data['status']) {
|
||||||
.autoPlay.value
|
return Obx(
|
||||||
? const SizedBox()
|
() => !videoDetailController
|
||||||
: PLVideoPlayer(
|
.autoPlay.value
|
||||||
controller:
|
? const SizedBox()
|
||||||
plPlayerController!,
|
: PLVideoPlayer(
|
||||||
headerControl:
|
controller:
|
||||||
videoDetailController
|
plPlayerController!,
|
||||||
.headerControl,
|
headerControl:
|
||||||
danmuWidget: Obx(
|
videoDetailController
|
||||||
() => PlDanmaku(
|
.headerControl,
|
||||||
key: Key(
|
danmuWidget: Obx(
|
||||||
videoDetailController
|
() => PlDanmaku(
|
||||||
.danmakuCid
|
key: Key(
|
||||||
.value
|
videoDetailController
|
||||||
.toString()),
|
.danmakuCid
|
||||||
cid:
|
.value
|
||||||
videoDetailController
|
.toString()),
|
||||||
.danmakuCid
|
cid:
|
||||||
.value,
|
videoDetailController
|
||||||
playerController:
|
.danmakuCid
|
||||||
plPlayerController!,
|
.value,
|
||||||
),
|
playerController:
|
||||||
|
plPlayerController!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
} else {
|
);
|
||||||
return const SizedBox();
|
} else {
|
||||||
}
|
return const SizedBox();
|
||||||
}),
|
}
|
||||||
),
|
}),
|
||||||
|
),
|
||||||
|
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: videoDetailController
|
visible: videoDetailController
|
||||||
.isShowCover.value,
|
.isShowCover.value,
|
||||||
child: Positioned(
|
child: Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
type: 'emote',
|
type: 'emote',
|
||||||
src: videoDetailController
|
src: videoDetailController
|
||||||
.videoItem['pic'],
|
.videoItem['pic'],
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
|
||||||
/// 关闭自动播放时 手动播放
|
/// 关闭自动播放时 手动播放
|
||||||
Obx(
|
Obx(
|
||||||
() => Visibility(
|
() => Visibility(
|
||||||
visible: videoDetailController
|
visible: videoDetailController
|
||||||
.isShowCover.value &&
|
.isShowCover.value &&
|
||||||
videoDetailController
|
videoDetailController
|
||||||
.isEffective.value &&
|
.isEffective.value &&
|
||||||
!videoDetailController
|
!videoDetailController
|
||||||
.autoPlay.value,
|
.autoPlay.value,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: AppBar(
|
child: AppBar(
|
||||||
primary: false,
|
primary: false,
|
||||||
foregroundColor:
|
foregroundColor: Colors.white,
|
||||||
Colors.white,
|
backgroundColor:
|
||||||
|
Colors.transparent,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
tooltip: '稍后再看',
|
||||||
|
onPressed: () async {
|
||||||
|
var res = await UserHttp
|
||||||
|
.toViewLater(
|
||||||
|
bvid:
|
||||||
|
videoDetailController
|
||||||
|
.bvid);
|
||||||
|
SmartDialog.showToast(
|
||||||
|
res['msg']);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons
|
||||||
|
.history_outlined),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 14)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
right: 12,
|
||||||
|
bottom: 10,
|
||||||
|
child: TextButton.icon(
|
||||||
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
Colors.transparent,
|
MaterialStateProperty
|
||||||
actions: [
|
.resolveWith(
|
||||||
IconButton(
|
(states) {
|
||||||
tooltip: '稍后再看',
|
return Theme.of(context)
|
||||||
onPressed: () async {
|
.colorScheme
|
||||||
var res = await UserHttp
|
.primaryContainer;
|
||||||
.toViewLater(
|
}),
|
||||||
bvid:
|
|
||||||
videoDetailController
|
|
||||||
.bvid);
|
|
||||||
SmartDialog.showToast(
|
|
||||||
res['msg']);
|
|
||||||
},
|
|
||||||
icon: const Icon(Icons
|
|
||||||
.history_outlined),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 14)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
onPressed: () => handlePlay(),
|
||||||
Positioned(
|
icon: const Icon(
|
||||||
right: 12,
|
Icons.play_circle_outline,
|
||||||
bottom: 10,
|
size: 20,
|
||||||
child: TextButton.icon(
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor:
|
|
||||||
MaterialStateProperty
|
|
||||||
.resolveWith(
|
|
||||||
(states) {
|
|
||||||
return Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primaryContainer;
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
onPressed: () =>
|
|
||||||
handlePlay(),
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.play_circle_outline,
|
|
||||||
size: 20,
|
|
||||||
),
|
|
||||||
label: const Text('Play'),
|
|
||||||
),
|
),
|
||||||
|
label: const Text('Play'),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
)),
|
],
|
||||||
),
|
)),
|
||||||
],
|
),
|
||||||
);
|
],
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
];
|
];
|
||||||
@ -433,8 +432,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
// },
|
// },
|
||||||
/// 不收回
|
/// 不收回
|
||||||
pinnedHeaderSliverHeightBuilder: () {
|
pinnedHeaderSliverHeightBuilder: () {
|
||||||
return plPlayerController!.isFullScreen.value ?
|
return plPlayerController?.isFullScreen.value == true
|
||||||
MediaQuery.of(context).size.height: pinnedHeaderHeight;
|
? MediaQuery.of(context).size.height
|
||||||
|
: pinnedHeaderHeight;
|
||||||
},
|
},
|
||||||
onlyOneScrollInBody: true,
|
onlyOneScrollInBody: true,
|
||||||
body: Container(
|
body: Container(
|
||||||
|
|||||||
Reference in New Issue
Block a user