feat: remove fan

Closes #733

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-22 18:05:02 +08:00
parent 1f2f00d49c
commit 7856857cca
8 changed files with 139 additions and 70 deletions

View File

@@ -1,4 +1,6 @@
import 'package:PiliPlus/common/skeleton/msg_feed_top.dart';
import 'package:PiliPlus/common/widgets/dialog.dart';
import 'package:PiliPlus/common/widgets/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/fans/result.dart';
@@ -9,7 +11,6 @@ import 'package:PiliPlus/common/widgets/http_error.dart';
import '../../utils/grid.dart';
import 'controller.dart';
import 'widgets/fan_item.dart';
class FansPage extends StatefulWidget {
const FansPage({super.key});
@@ -34,7 +35,7 @@ class _FansPageState extends State<FansPage> {
return Scaffold(
appBar: AppBar(
title: Text(
_fansController.isOwner.value ? '我的粉丝' : '${_fansController.name}的粉丝',
_fansController.isOwner ? '我的粉丝' : '${_fansController.name}的粉丝',
),
),
body: SafeArea(
@@ -81,7 +82,47 @@ class _FansPageState extends State<FansPage> {
if (index == loadingState.response!.length - 1) {
_fansController.onLoadMore();
}
return fanItem(item: loadingState.response![index]);
final item = loadingState.response![index];
String heroTag = Utils.makeHeroTag(item.mid);
return ListTile(
onTap: () {
Get.toNamed(
'/member?mid=${item.mid}',
arguments: {'face': item.face, 'heroTag': heroTag},
);
},
onLongPress: _fansController.isOwner
? () {
showConfirmDialog(
context: context,
title: '确定移除 ${item.uname} ',
onConfirm: () {
_fansController.onRemoveFan(index, item.mid!);
},
);
}
: null,
leading: Hero(
tag: heroTag,
child: NetworkImgLayer(
width: 45,
height: 45,
type: 'avatar',
src: item.face,
),
),
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),
);
},
childCount: loadingState.response!.length,
),