mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-16 07:06:14 +08:00
fix: view fan/follow list from member info
This commit is contained in:
@@ -88,15 +88,7 @@ class MemberControllerNew extends CommonController
|
|||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.back();
|
Get.back();
|
||||||
var res = await VideoHttp.relationMod(
|
_onBlock();
|
||||||
mid: mid ?? -1,
|
|
||||||
act: relation.value != -1 ? 5 : 6,
|
|
||||||
reSrc: 11,
|
|
||||||
);
|
|
||||||
if (res['status']) {
|
|
||||||
relation.value = relation.value != -1 ? -1 : 1;
|
|
||||||
isFollow.value = false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: const Text('确认'),
|
child: const Text('确认'),
|
||||||
)
|
)
|
||||||
@@ -109,4 +101,26 @@ class MemberControllerNew extends CommonController
|
|||||||
void shareUser() {
|
void shareUser() {
|
||||||
Share.share('https://space.bilibili.com/$mid');
|
Share.share('https://space.bilibili.com/$mid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onBlock() async {
|
||||||
|
dynamic res = await VideoHttp.relationMod(
|
||||||
|
mid: mid ?? -1,
|
||||||
|
act: relation.value != -1 ? 5 : 6,
|
||||||
|
reSrc: 11,
|
||||||
|
);
|
||||||
|
if (res['status']) {
|
||||||
|
relation.value = relation.value != -1 ? -1 : 1;
|
||||||
|
isFollow.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onFollow() async {
|
||||||
|
if (relation.value == -1) {
|
||||||
|
_onBlock();
|
||||||
|
} else if (!isFollow.value) {
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ class _MemberPageNewState extends State<MemberPageNew>
|
|||||||
isFollow: _userController.isFollow.value,
|
isFollow: _userController.isFollow.value,
|
||||||
card: userState.response.card,
|
card: userState.response.card,
|
||||||
images: userState.response.images,
|
images: userState.response.images,
|
||||||
// onFollow: _userController.onFollow,
|
onFollow: _userController.onFollow,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
required this.images,
|
required this.images,
|
||||||
required this.relation,
|
required this.relation,
|
||||||
required this.isFollow,
|
required this.isFollow,
|
||||||
// required this.onFollow,
|
required this.onFollow,
|
||||||
});
|
});
|
||||||
|
|
||||||
final int relation;
|
final int relation;
|
||||||
final bool isFollow;
|
final bool isFollow;
|
||||||
final space.Card card;
|
final space.Card card;
|
||||||
final space.Images images;
|
final space.Images images;
|
||||||
// final Function(dynamic uid, dynamic isFollow) onFollow;
|
final VoidCallback onFollow;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -154,10 +154,10 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/follow?mid=${card.mid}&name=${card.name}');
|
'/fan?mid=${card.mid}&name=${card.name}');
|
||||||
} else if (index == 2) {
|
} else if (index == 2) {
|
||||||
Get.toNamed(
|
Get.toNamed(
|
||||||
'/fan?mid=${card.mid}&name=${card.name}');
|
'/follow?mid=${card.mid}&name=${card.name}');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -206,7 +206,7 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
FilledButton.tonal(
|
FilledButton.tonal(
|
||||||
onPressed: () {},
|
onPressed: onFollow,
|
||||||
style: FilledButton.styleFrom(
|
style: FilledButton.styleFrom(
|
||||||
backgroundColor: relation == -1 || isFollow
|
backgroundColor: relation == -1 || isFollow
|
||||||
? Theme.of(context).colorScheme.onInverseSurface
|
? Theme.of(context).colorScheme.onInverseSurface
|
||||||
|
|||||||
Reference in New Issue
Block a user