Merge branch 'guozhigq:main' into refactor-danmaku_controller

This commit is contained in:
orz12
2023-12-24 03:11:49 +08:00
committed by GitHub
4 changed files with 209 additions and 185 deletions

View File

@ -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

View File

@ -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(

View File

@ -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';
}
} }
} }

View File

@ -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,26 +259,14 @@ 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,
onPopInvoked: (bool didPop) {
if (plPlayerController!.isFullScreen.value) {
plPlayerController!
.triggerFullScreen(status: false);
}
if (MediaQuery.of(context).orientation ==
Orientation.landscape) {
verticalScreen();
}
},
child: SliverAppBar(
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
pinned: false, pinned: false,
elevation: 0, elevation: 0,
scrolledUnderElevation: 0, scrolledUnderElevation: 0,
forceElevated: innerBoxIsScrolled, forceElevated: innerBoxIsScrolled,
expandedHeight: expandedHeight:
plPlayerController!.isFullScreen.value || plPlayerController?.isFullScreen.value == true ||
MediaQuery.of(context).orientation == MediaQuery.of(context).orientation ==
Orientation.landscape Orientation.landscape
? MediaQuery.of(context).size.height - ? MediaQuery.of(context).size.height -
@ -289,7 +277,21 @@ class _VideoDetailPageState extends State<VideoDetailPage>
: videoHeight, : videoHeight,
backgroundColor: Colors.black, backgroundColor: Colors.black,
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
background: LayoutBuilder( background: PopScope(
canPop:
plPlayerController?.isFullScreen.value != true,
onPopInvoked: (bool didPop) {
if (plPlayerController?.isFullScreen.value ==
true) {
plPlayerController!
.triggerFullScreen(status: false);
}
if (MediaQuery.of(context).orientation ==
Orientation.landscape) {
verticalScreen();
}
},
child: LayoutBuilder(
builder: (context, boxConstraints) { builder: (context, boxConstraints) {
double maxWidth = boxConstraints.maxWidth; double maxWidth = boxConstraints.maxWidth;
double maxHeight = boxConstraints.maxHeight; double maxHeight = boxConstraints.maxHeight;
@ -369,8 +371,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
right: 0, right: 0,
child: AppBar( child: AppBar(
primary: false, primary: false,
foregroundColor: foregroundColor: Colors.white,
Colors.white,
backgroundColor: backgroundColor:
Colors.transparent, Colors.transparent,
actions: [ actions: [
@ -406,8 +407,7 @@ class _VideoDetailPageState extends State<VideoDetailPage>
.primaryContainer; .primaryContainer;
}), }),
), ),
onPressed: () => onPressed: () => handlePlay(),
handlePlay(),
icon: const Icon( icon: const Icon(
Icons.play_circle_outline, Icons.play_circle_outline,
size: 20, size: 20,
@ -421,7 +421,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
], ],
); );
}, },
),
)), )),
)), )),
]; ];
@ -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(