mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-05 09:37:52 +08:00
@@ -8,7 +8,7 @@ import 'package:get/get.dart';
|
||||
|
||||
class FollowItem extends StatelessWidget {
|
||||
final FollowItemModel item;
|
||||
final bool? isOwner;
|
||||
final bool isOwner;
|
||||
final ValueChanged? afterMod;
|
||||
final ValueChanged<UserModel>? onSelect;
|
||||
|
||||
@@ -16,15 +16,38 @@ class FollowItem extends StatelessWidget {
|
||||
super.key,
|
||||
required this.item,
|
||||
this.afterMod,
|
||||
this.isOwner,
|
||||
bool? isOwner,
|
||||
this.onSelect,
|
||||
});
|
||||
}) : isOwner = isOwner ?? false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = ColorScheme.of(context);
|
||||
Widget? followBtn;
|
||||
if (isOwner) {
|
||||
final isFollow = item.attribute != -1;
|
||||
followBtn = FilledButton.tonal(
|
||||
onPressed: () => RequestUtils.actionRelationMod(
|
||||
context: context,
|
||||
mid: item.mid,
|
||||
isFollow: isFollow,
|
||||
afterMod: afterMod,
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
visualDensity: .compact,
|
||||
tapTargetSize: .shrinkWrap,
|
||||
padding: const .symmetric(horizontal: 15),
|
||||
foregroundColor: isFollow ? colorScheme.outline : null,
|
||||
backgroundColor: isFollow ? colorScheme.onInverseSurface : null,
|
||||
),
|
||||
child: Text(
|
||||
'${isFollow ? '已' : ''}关注',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
type: .transparency,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (onSelect != null) {
|
||||
@@ -42,10 +65,7 @@ class FollowItem extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 10,
|
||||
),
|
||||
padding: const .symmetric(horizontal: 12, vertical: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
PendantAvatar(
|
||||
@@ -58,19 +78,19 @@ class FollowItem extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Column(
|
||||
spacing: 3,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: .start,
|
||||
children: [
|
||||
Text(
|
||||
item.uname!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: .ellipsis,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
),
|
||||
if (item.sign != null)
|
||||
Text(
|
||||
item.sign!,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: .ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: colorScheme.outline,
|
||||
@@ -79,30 +99,7 @@ class FollowItem extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isOwner ?? false)
|
||||
FilledButton.tonal(
|
||||
onPressed: () => RequestUtils.actionRelationMod(
|
||||
context: context,
|
||||
mid: item.mid,
|
||||
isFollow: item.attribute != -1,
|
||||
afterMod: afterMod,
|
||||
),
|
||||
style: FilledButton.styleFrom(
|
||||
visualDensity: .compact,
|
||||
tapTargetSize: .shrinkWrap,
|
||||
padding: const .symmetric(horizontal: 15),
|
||||
foregroundColor: item.attribute == -1
|
||||
? null
|
||||
: colorScheme.outline,
|
||||
backgroundColor: item.attribute == -1
|
||||
? null
|
||||
: colorScheme.onInverseSurface,
|
||||
),
|
||||
child: Text(
|
||||
'${item.attribute == -1 ? '' : '已'}关注',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
?followBtn,
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user