chore: follow up accept decline kick
This commit is contained in:
parent
5795857b78
commit
45e72428e2
2 changed files with 23 additions and 10 deletions
|
|
@ -250,6 +250,26 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void knockAccept() async {
|
||||||
|
final user = widget.user!;
|
||||||
|
final result = await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () => user.room.invite(user.id),
|
||||||
|
);
|
||||||
|
if (result.error != null) return;
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void knockDecline() async {
|
||||||
|
final user = widget.user!;
|
||||||
|
final result = await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () => user.room.kick(user.id),
|
||||||
|
);
|
||||||
|
if (result.error != null) return;
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => UserBottomSheetView(this);
|
Widget build(BuildContext context) => UserBottomSheetView(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_linkify/flutter_linkify.dart';
|
import 'package:flutter_linkify/flutter_linkify.dart';
|
||||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/config/app_config.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
|
|
@ -111,7 +110,7 @@ class UserBottomSheetView extends StatelessWidget {
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(12.0),
|
padding: const EdgeInsets.all(12.0),
|
||||||
child: Material(
|
child: Material(
|
||||||
color: Theme.of(context).colorScheme.tertiaryContainer,
|
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
minVerticalPadding: 16,
|
minVerticalPadding: 16,
|
||||||
|
|
@ -131,10 +130,7 @@ class UserBottomSheetView extends StatelessWidget {
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).colorScheme.primary,
|
Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
onPressed: () => showFutureLoadingDialog(
|
onPressed: controller.knockAccept,
|
||||||
context: context,
|
|
||||||
future: () => user!.room.invite(user.id),
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.check_outlined),
|
icon: const Icon(Icons.check_outlined),
|
||||||
label: Text(L10n.of(context)!.accept),
|
label: Text(L10n.of(context)!.accept),
|
||||||
),
|
),
|
||||||
|
|
@ -146,10 +142,7 @@ class UserBottomSheetView extends StatelessWidget {
|
||||||
foregroundColor:
|
foregroundColor:
|
||||||
Theme.of(context).colorScheme.onErrorContainer,
|
Theme.of(context).colorScheme.onErrorContainer,
|
||||||
),
|
),
|
||||||
onPressed: () => showFutureLoadingDialog(
|
onPressed: controller.knockDecline,
|
||||||
context: context,
|
|
||||||
future: () => user!.room.kick(user.id),
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.cancel_outlined),
|
icon: const Icon(Icons.cancel_outlined),
|
||||||
label: Text(L10n.of(context)!.decline),
|
label: Text(L10n.of(context)!.decline),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue