mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: follow page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -9,7 +9,14 @@ import 'package:PiliPlus/utils/utils.dart';
|
||||
class FollowItem extends StatelessWidget {
|
||||
final FollowItemModel item;
|
||||
final FollowController? ctr;
|
||||
const FollowItem({super.key, required this.item, this.ctr});
|
||||
final ValueChanged? callback;
|
||||
|
||||
const FollowItem({
|
||||
super.key,
|
||||
required this.item,
|
||||
this.callback,
|
||||
this.ctr,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -41,31 +48,34 @@ class FollowItem extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
dense: true,
|
||||
trailing: ctr != null && ctr!.isOwner.value
|
||||
trailing: ctr?.isOwner.value == true
|
||||
? SizedBox(
|
||||
height: 34,
|
||||
child: TextButton(
|
||||
child: FilledButton.tonal(
|
||||
onPressed: () {
|
||||
Utils.actionRelationMod(
|
||||
context: context,
|
||||
mid: item.mid,
|
||||
isFollow: true,
|
||||
callback: (attribute) {},
|
||||
isFollow: item.attribute != -1,
|
||||
callback: callback,
|
||||
);
|
||||
},
|
||||
style: TextButton.styleFrom(
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
|
||||
foregroundColor: Theme.of(context).colorScheme.outline,
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.onInverseSurface,
|
||||
foregroundColor: item.attribute == -1
|
||||
? null
|
||||
: Theme.of(context).colorScheme.outline,
|
||||
backgroundColor: item.attribute == -1
|
||||
? null
|
||||
: Theme.of(context).colorScheme.onInverseSurface,
|
||||
),
|
||||
child: const Text(
|
||||
'已关注',
|
||||
child: Text(
|
||||
'${item.attribute == -1 ? '' : '已'}关注',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
: null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,11 @@ class _OwnerFollowListState extends State<OwnerFollowList>
|
||||
return FollowItem(
|
||||
item: followList[index],
|
||||
ctr: widget.ctr,
|
||||
callback: (attr) {
|
||||
followList[index].attribute =
|
||||
attr == 0 ? -1 : 0;
|
||||
followList.refresh();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user