Closes #1050

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-20 22:04:39 +08:00
parent e096ebcbba
commit 76f1d0129b
171 changed files with 2190 additions and 2063 deletions

View File

@@ -3,6 +3,7 @@ import 'package:PiliPlus/common/widgets/dialog/dialog.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/common/widgets/view_sliver_safe_area.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/image_type.dart';
import 'package:PiliPlus/models_new/fans/list.dart';
@@ -51,27 +52,22 @@ class _FansPageState extends State<FansPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: widget.mid != null
? null
: AppBar(title: Text(isOwner ? '我的粉丝' : '$name的粉丝')),
body: SafeArea(
bottom: false,
child: refreshIndicator(
onRefresh: _fansController.onRefresh,
child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
controller: _fansController.scrollController,
slivers: [
SliverPadding(
padding: EdgeInsets.only(
bottom: MediaQuery.paddingOf(context).bottom + 80,
),
sliver: Obx(
() => _buildBody(_fansController.loadingState.value),
),
body: refreshIndicator(
onRefresh: _fansController.onRefresh,
child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
controller: _fansController.scrollController,
slivers: [
ViewSliverSafeArea(
sliver: Obx(
() => _buildBody(_fansController.loadingState.value),
),
],
),
),
],
),
),
);
@@ -98,47 +94,65 @@ class _FansPageState extends State<FansPage> {
_fansController.onLoadMore();
}
final item = response[index];
return ListTile(
onTap: () {
if (widget.onSelect != null) {
widget.onSelect!(
UserModel(
mid: item.mid!,
name: item.uname!,
avatar: item.face!,
),
);
return;
}
Get.toNamed('/member?mid=${item.mid}');
},
onLongPress: widget.onSelect != null
? null
: isOwner
? () => showConfirmDialog(
context: context,
title: '确定移除 ${item.uname} ',
onConfirm: () =>
_fansController.onRemoveFan(index, item.mid!),
)
: null,
leading: NetworkImgLayer(
width: 45,
height: 45,
type: ImageType.avatar,
src: item.face,
return SizedBox(
height: 66,
child: InkWell(
onTap: () {
if (widget.onSelect != null) {
widget.onSelect!(
UserModel(
mid: item.mid!,
name: item.uname!,
avatar: item.face!,
),
);
return;
}
Get.toNamed('/member?mid=${item.mid}');
},
onLongPress: widget.onSelect != null
? null
: isOwner
? () => showConfirmDialog(
context: context,
title: '确定移除 ${item.uname} ',
onConfirm: () =>
_fansController.onRemoveFan(index, item.mid!),
)
: null,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 10,
),
child: Row(
spacing: 10,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
NetworkImgLayer(
width: 45,
height: 45,
type: ImageType.avatar,
src: item.face,
),
Column(
spacing: 5,
children: [
Text(
item.uname!,
style: const TextStyle(fontSize: 14),
),
Text(
item.sign ?? '',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
],
),
),
),
title: Text(
item.uname!,
style: const TextStyle(fontSize: 14),
),
subtitle: Text(
item.sign ?? '',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
dense: true,
trailing: const SizedBox(width: 6),
);
},
itemCount: response!.length,