kopia lustrzana https://gitlab.com/mysocialportal/relatica
Add confirmations on follow/unfollow and group add/remove
rodzic
7b2dce96a2
commit
2ac06454b4
|
@ -132,11 +132,20 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
|
|||
onChanged: isUpdating
|
||||
? null
|
||||
: (bool? value) async {
|
||||
final isAdding = value == true;
|
||||
final confirm = await showYesNoDialog(
|
||||
context,
|
||||
isAdding
|
||||
? 'Add user to ${g.name}'
|
||||
: 'Remove user from ${g.name}');
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
print('Started updating/isupdating cycle');
|
||||
isUpdating = true;
|
||||
});
|
||||
if (value == true) {
|
||||
if (isAdding) {
|
||||
await manager.addUserToGroup(g, profile);
|
||||
} else {
|
||||
await manager.removeUserFromGroup(g, profile);
|
||||
|
@ -173,6 +182,11 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
|
|||
onPressed: isUpdating
|
||||
? null
|
||||
: () async {
|
||||
final confirm = await showYesNoDialog(
|
||||
context, 'Unfollow ${profile.name}');
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
print('Started updating/isupdating cycle');
|
||||
isUpdating = true;
|
||||
|
@ -192,6 +206,11 @@ class _UserProfileScreenState extends State<UserProfileScreen> {
|
|||
onPressed: isUpdating
|
||||
? null
|
||||
: () async {
|
||||
final confirm =
|
||||
await showYesNoDialog(context, 'Follow ${profile.name}');
|
||||
if (confirm != true) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
print('Started updating/isupdating cycle');
|
||||
isUpdating = true;
|
||||
|
|
Ładowanie…
Reference in New Issue