chore: Enhance invitiation UX

This commit is contained in:
Christian Pauly 2022-07-08 10:55:07 +02:00
parent d25d8cc1c2
commit c420343db9
4 changed files with 26 additions and 9 deletions

View File

@ -26,7 +26,6 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('Connect'), findsOneWidget);
expect(find.text('Homeserver'), findsOneWidget);
final input = find.byType(TextField);

View File

@ -180,11 +180,12 @@ class _ChatListViewBodyState extends State<ChatListViewBody> {
.onSecondaryContainer,
),
title: Text(
Matrix.of(context)
(Matrix.of(context)
.client
.encryption!
.keyManager
.enabled
.encryption
?.keyManager
.enabled ==
true)
? L10n.of(context)!.unlockOldMessages
: L10n.of(context)!.enableAutoBackups,
style: TextStyle(

View File

@ -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(

View File

@ -32,7 +32,14 @@ class InvitationSelectionView extends StatelessWidget {
autofocus: true,
decoration: InputDecoration(
hintText: L10n.of(context)!.inviteContactToGroup(groupName),
suffix: const Icon(Icons.search_outlined),
suffixIconConstraints: const BoxConstraints(
maxWidth: 48,
maxHeight: 48,
minWidth: 48,
),
suffixIcon: controller.loading
? const CircularProgressIndicator.adaptive()
: const Icon(Icons.search_outlined),
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
),
onChanged: controller.searchUserWithCoolDown,