chore: Enhance invitiation UX
This commit is contained in:
parent
5558877c34
commit
378a0b9781
4 changed files with 26 additions and 9 deletions
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -50,10 +51,19 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||
}
|
||||
|
||||
void inviteAction(BuildContext context, String id) async {
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!);
|
||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||
if (OkCancelResult.ok !=
|
||||
await showOkCancelAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.inviteContactToGroup(room.displayname),
|
||||
okLabel: L10n.of(context)!.yes,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room!.invite(id),
|
||||
future: () => room.invite(id),
|
||||
);
|
||||
if (success.error == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue