opt: follow page

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-02-21 18:18:16 +08:00
parent 516eed76b7
commit 27bc68f264
3 changed files with 34 additions and 40 deletions

View File

@@ -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,
);
}
}

View File

@@ -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();
},
);
}
},