mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-17 07:36:14 +08:00
feat: follow staff
Closes #481 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:PiliPlus/http/init.dart';
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/member.dart';
|
import 'package:PiliPlus/http/member.dart';
|
||||||
import 'package:PiliPlus/pages/dynamics/repost_dyn_panel.dart';
|
import 'package:PiliPlus/pages/dynamics/repost_dyn_panel.dart';
|
||||||
@@ -38,6 +39,7 @@ class VideoIntroController extends GetxController
|
|||||||
|
|
||||||
// 视频详情 上个页面传入
|
// 视频详情 上个页面传入
|
||||||
Map videoItem = {};
|
Map videoItem = {};
|
||||||
|
late final RxMap staffRelations = {}.obs;
|
||||||
|
|
||||||
// 请求状态
|
// 请求状态
|
||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = false.obs;
|
||||||
@@ -148,6 +150,23 @@ class VideoIntroController extends GetxController
|
|||||||
}
|
}
|
||||||
videoDetail.value = result['data'];
|
videoDetail.value = result['data'];
|
||||||
videoItem['staff'] = result['data'].staff;
|
videoItem['staff'] = result['data'].staff;
|
||||||
|
if (result['data'].staff?.isNotEmpty == true) {
|
||||||
|
Request().get(
|
||||||
|
'/x/relation/relations',
|
||||||
|
queryParameters: {
|
||||||
|
'fids': (result['data'].staff as List<Staff>)
|
||||||
|
.map((item) => item.mid)
|
||||||
|
.join(',')
|
||||||
|
},
|
||||||
|
).then((res) {
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
staffRelations.value = {
|
||||||
|
'status': true,
|
||||||
|
...res.data['data'],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
final videoDetailController =
|
final videoDetailController =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
|
|||||||
@@ -473,6 +473,64 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 0,
|
||||||
|
right: -6,
|
||||||
|
child: Obx(() => videoIntroController
|
||||||
|
.staffRelations[
|
||||||
|
'status'] ==
|
||||||
|
true &&
|
||||||
|
videoIntroController
|
||||||
|
.staffRelations[
|
||||||
|
'${videoItem['staff'][index].mid}'] ==
|
||||||
|
null
|
||||||
|
? Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
customBorder:
|
||||||
|
const CircleBorder(),
|
||||||
|
onTap: () {
|
||||||
|
Utils
|
||||||
|
.actionRelationMod(
|
||||||
|
context: context,
|
||||||
|
mid: videoItem[
|
||||||
|
'staff']
|
||||||
|
[index]
|
||||||
|
.mid,
|
||||||
|
isFollow: false,
|
||||||
|
callback: (val) {
|
||||||
|
videoIntroController
|
||||||
|
.staffRelations[
|
||||||
|
'${videoItem['staff'][index].mid}'] = true;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Ink(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets
|
||||||
|
.all(2),
|
||||||
|
decoration:
|
||||||
|
BoxDecoration(
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.colorScheme
|
||||||
|
.secondaryContainer,
|
||||||
|
shape:
|
||||||
|
BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
MdiIcons.plus,
|
||||||
|
size: 16,
|
||||||
|
color: Theme.of(
|
||||||
|
context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox.shrink()),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
|
|||||||
Reference in New Issue
Block a user