mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-27 22:05:53 +08:00
@@ -71,47 +71,48 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
return switch (userState) {
|
||||
Loading() => loadingWidget,
|
||||
Success(:var response) => Column(
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
iconButton(
|
||||
context: context,
|
||||
onPressed: Get.back,
|
||||
tooltip: '关闭',
|
||||
icon: Icons.clear,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
),
|
||||
_buildUserInfo(theme, response),
|
||||
Expanded(
|
||||
child: refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: _controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildSliverHeader(theme),
|
||||
Obx(() =>
|
||||
_buildVideoList(theme, _controller.loadingState.value)),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
iconButton(
|
||||
context: context,
|
||||
onPressed: Get.back,
|
||||
tooltip: '关闭',
|
||||
icon: Icons.clear,
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
],
|
||||
),
|
||||
_buildUserInfo(theme, response),
|
||||
Expanded(
|
||||
child: refreshIndicator(
|
||||
onRefresh: _controller.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: _controller.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
_buildSliverHeader(theme),
|
||||
Obx(
|
||||
() =>
|
||||
_buildVideoList(theme, _controller.loadingState.value),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Error(:var errMsg) => scrollErrorWidget(
|
||||
controller: _controller.scrollController,
|
||||
errMsg: errMsg,
|
||||
onReload: () {
|
||||
_controller.userState.value =
|
||||
LoadingState<MemberInfoModel>.loading();
|
||||
_controller.getUserInfo();
|
||||
},
|
||||
),
|
||||
controller: _controller.scrollController,
|
||||
errMsg: errMsg,
|
||||
onReload: () {
|
||||
_controller.userState.value = LoadingState<MemberInfoModel>.loading();
|
||||
_controller.getUserInfo();
|
||||
},
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -141,8 +142,8 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
height: 35,
|
||||
child: TextButton.icon(
|
||||
onPressed: () => _controller
|
||||
..lastAid =
|
||||
widget.videoDetailController.oid.value.toString()
|
||||
..lastAid = widget.videoDetailController.oid.value
|
||||
.toString()
|
||||
..queryBySort(),
|
||||
icon: Icon(
|
||||
Icons.sort,
|
||||
@@ -159,7 +160,7 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -168,58 +169,61 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
}
|
||||
|
||||
Widget _buildVideoList(
|
||||
ThemeData theme, LoadingState<List<SpaceArchiveItem>?> loadingState) {
|
||||
ThemeData theme,
|
||||
LoadingState<List<SpaceArchiveItem>?> loadingState,
|
||||
) {
|
||||
return switch (loadingState) {
|
||||
Loading() => SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: 10,
|
||||
(context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
),
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
childCount: 10,
|
||||
(context, index) {
|
||||
return const VideoCardHSkeleton();
|
||||
},
|
||||
),
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
if (index == response.length - 1 && _controller.hasNext) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
final SpaceArchiveItem videoItem = response[index];
|
||||
return VideoCardHMemberVideo(
|
||||
videoItem: videoItem,
|
||||
bvid: _bvid,
|
||||
onTap: () {
|
||||
final status =
|
||||
widget.videoIntroController.changeSeasonOrbangu(
|
||||
null,
|
||||
videoItem.bvid,
|
||||
videoItem.cid,
|
||||
IdUtils.bv2av(videoItem.bvid!),
|
||||
videoItem.cover,
|
||||
);
|
||||
if (status) {
|
||||
_bvid = videoItem.bvid;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
childCount: response!.length,
|
||||
),
|
||||
Success(:var response) =>
|
||||
response?.isNotEmpty == true
|
||||
? SliverPadding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
),
|
||||
),
|
||||
)
|
||||
: HttpError(onReload: _controller.onReload),
|
||||
sliver: SliverGrid(
|
||||
gridDelegate: Grid.videoCardHDelegate(context),
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) {
|
||||
if (index == response.length - 1 && _controller.hasNext) {
|
||||
_controller.onLoadMore();
|
||||
}
|
||||
final SpaceArchiveItem videoItem = response[index];
|
||||
return VideoCardHMemberVideo(
|
||||
videoItem: videoItem,
|
||||
bvid: _bvid,
|
||||
onTap: () {
|
||||
final status = widget.videoIntroController
|
||||
.changeSeasonOrbangu(
|
||||
null,
|
||||
videoItem.bvid,
|
||||
videoItem.cid,
|
||||
IdUtils.bv2av(videoItem.bvid!),
|
||||
videoItem.cover,
|
||||
);
|
||||
if (status) {
|
||||
_bvid = videoItem.bvid;
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
childCount: response!.length,
|
||||
),
|
||||
),
|
||||
)
|
||||
: HttpError(onReload: _controller.onReload),
|
||||
Error(:var errMsg) => HttpError(
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
errMsg: errMsg,
|
||||
onReload: _controller.onReload,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -236,139 +240,140 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
}
|
||||
|
||||
Column _buildInfo(ThemeData theme, MemberInfoModel memberInfoModel) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () => Utils.copyText(memberInfoModel.name ?? ''),
|
||||
child: Text(
|
||||
memberInfoModel.name ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: (memberInfoModel.vip?.status ?? -1) > 0 &&
|
||||
memberInfoModel.vip?.type == 2
|
||||
? context.vipColor
|
||||
: null,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => Utils.copyText(memberInfoModel.name ?? ''),
|
||||
child: Text(
|
||||
memberInfoModel.name ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color:
|
||||
(memberInfoModel.vip?.status ?? -1) > 0 &&
|
||||
memberInfoModel.vip?.type == 2
|
||||
? context.vipColor
|
||||
: null,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Image.asset(
|
||||
'assets/images/lv/lv${memberInfoModel.isSeniorMember == 1 ? '6_s' : memberInfoModel.level}.png',
|
||||
height: 11,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Obx(
|
||||
() => Row(
|
||||
children: List.generate(5, (index) {
|
||||
if (index % 2 == 0) {
|
||||
return _buildChildInfo(
|
||||
theme: theme,
|
||||
title: const ['粉丝', '关注', '获赞'][index ~/ 2],
|
||||
num: index == 0
|
||||
? _controller.userStat['follower'] != null
|
||||
? NumUtil.numFormat(
|
||||
_controller.userStat['follower'])
|
||||
: ''
|
||||
: index == 2
|
||||
? _controller.userStat['following'] ?? ''
|
||||
: _controller.userStat['likes'] != null
|
||||
? NumUtil.numFormat(
|
||||
_controller.userStat['likes'])
|
||||
: '',
|
||||
onTap: () {
|
||||
if (index == 0) {
|
||||
Get.toNamed(
|
||||
'/fan?mid=${widget.mid}&name=${memberInfoModel.name}');
|
||||
} else if (index == 2) {
|
||||
Get.toNamed(
|
||||
'/follow?mid=${widget.mid}&name=${memberInfoModel.name}');
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 10,
|
||||
width: 20,
|
||||
child: VerticalDivider(
|
||||
width: 1,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: memberInfoModel.isFollowed == true
|
||||
? theme.colorScheme.onInverseSurface
|
||||
: null,
|
||||
foregroundColor: memberInfoModel.isFollowed == true
|
||||
? theme.colorScheme.outline
|
||||
: null,
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(vertical: -2),
|
||||
),
|
||||
onPressed: () {
|
||||
if (widget.mid == accountService.mid) {
|
||||
Get.toNamed('/editProfile');
|
||||
} else {
|
||||
if (!accountService.isLogin.value) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
RequestUtils.actionRelationMod(
|
||||
context: context,
|
||||
mid: widget.mid,
|
||||
isFollow: memberInfoModel.isFollowed ?? false,
|
||||
callback: (attribute) {
|
||||
_controller
|
||||
..userState.value.data.isFollowed = attribute != 0
|
||||
..userState.refresh();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
widget.mid == accountService.mid
|
||||
? '编辑资料'
|
||||
: memberInfoModel.isFollowed == true
|
||||
? '已关注'
|
||||
: '关注',
|
||||
maxLines: 1,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(vertical: -2),
|
||||
),
|
||||
onPressed: () => Get.toNamed('/member?mid=${widget.mid}'),
|
||||
child: const Text(
|
||||
'查看主页',
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(width: 8),
|
||||
Image.asset(
|
||||
'assets/images/lv/lv${memberInfoModel.isSeniorMember == 1 ? '6_s' : memberInfoModel.level}.png',
|
||||
height: 11,
|
||||
),
|
||||
],
|
||||
);
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Obx(
|
||||
() => Row(
|
||||
children: List.generate(5, (index) {
|
||||
if (index % 2 == 0) {
|
||||
return _buildChildInfo(
|
||||
theme: theme,
|
||||
title: const ['粉丝', '关注', '获赞'][index ~/ 2],
|
||||
num: index == 0
|
||||
? _controller.userStat['follower'] != null
|
||||
? NumUtil.numFormat(_controller.userStat['follower'])
|
||||
: ''
|
||||
: index == 2
|
||||
? _controller.userStat['following'] ?? ''
|
||||
: _controller.userStat['likes'] != null
|
||||
? NumUtil.numFormat(_controller.userStat['likes'])
|
||||
: '',
|
||||
onTap: () {
|
||||
if (index == 0) {
|
||||
Get.toNamed(
|
||||
'/fan?mid=${widget.mid}&name=${memberInfoModel.name}',
|
||||
);
|
||||
} else if (index == 2) {
|
||||
Get.toNamed(
|
||||
'/follow?mid=${widget.mid}&name=${memberInfoModel.name}',
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 10,
|
||||
width: 20,
|
||||
child: VerticalDivider(
|
||||
width: 1,
|
||||
color: theme.colorScheme.outline,
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.tonal(
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: memberInfoModel.isFollowed == true
|
||||
? theme.colorScheme.onInverseSurface
|
||||
: null,
|
||||
foregroundColor: memberInfoModel.isFollowed == true
|
||||
? theme.colorScheme.outline
|
||||
: null,
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(vertical: -2),
|
||||
),
|
||||
onPressed: () {
|
||||
if (widget.mid == accountService.mid) {
|
||||
Get.toNamed('/editProfile');
|
||||
} else {
|
||||
if (!accountService.isLogin.value) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
RequestUtils.actionRelationMod(
|
||||
context: context,
|
||||
mid: widget.mid,
|
||||
isFollow: memberInfoModel.isFollowed ?? false,
|
||||
callback: (attribute) {
|
||||
_controller
|
||||
..userState.value.data.isFollowed = attribute != 0
|
||||
..userState.refresh();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
widget.mid == accountService.mid
|
||||
? '编辑资料'
|
||||
: memberInfoModel.isFollowed == true
|
||||
? '已关注'
|
||||
: '关注',
|
||||
maxLines: 1,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
visualDensity: const VisualDensity(vertical: -2),
|
||||
),
|
||||
onPressed: () => Get.toNamed('/member?mid=${widget.mid}'),
|
||||
child: const Text(
|
||||
'查看主页',
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
Widget _buildChildInfo({
|
||||
required ThemeData theme,
|
||||
@@ -389,18 +394,18 @@ class _HorizontalMemberPageState extends State<HorizontalMemberPage> {
|
||||
}
|
||||
|
||||
Widget _buildAvatar(String face) => GestureDetector(
|
||||
onTap: () {
|
||||
widget.videoDetailController.onViewImage();
|
||||
context.imageView(
|
||||
imgList: [SourceModel(url: face)],
|
||||
onDismissed: widget.videoDetailController.onDismissed,
|
||||
);
|
||||
},
|
||||
child: NetworkImgLayer(
|
||||
src: face,
|
||||
type: ImageType.avatar,
|
||||
width: 70,
|
||||
height: 70,
|
||||
),
|
||||
onTap: () {
|
||||
widget.videoDetailController.onViewImage();
|
||||
context.imageView(
|
||||
imgList: [SourceModel(url: face)],
|
||||
onDismissed: widget.videoDetailController.onDismissed,
|
||||
);
|
||||
},
|
||||
child: NetworkImgLayer(
|
||||
src: face,
|
||||
type: ImageType.avatar,
|
||||
width: 70,
|
||||
height: 70,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user