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(); await tester.pumpAndSettle();
expect(find.text('Connect'), findsOneWidget); expect(find.text('Connect'), findsOneWidget);
expect(find.text('Homeserver'), findsOneWidget);
final input = find.byType(TextField); final input = find.byType(TextField);

View File

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

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:matrix/matrix.dart'; import 'package:matrix/matrix.dart';
@ -50,10 +51,19 @@ class InvitationSelectionController extends State<InvitationSelection> {
} }
void inviteAction(BuildContext context, String id) async { 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( final success = await showFutureLoadingDialog(
context: context, context: context,
future: () => room!.invite(id), future: () => room.invite(id),
); );
if (success.error == null) { if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar( ScaffoldMessenger.of(context).showSnackBar(SnackBar(

View File

@ -32,7 +32,14 @@ class InvitationSelectionView extends StatelessWidget {
autofocus: true, autofocus: true,
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context)!.inviteContactToGroup(groupName), 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), contentPadding: const EdgeInsets.symmetric(horizontal: 16),
), ),
onChanged: controller.searchUserWithCoolDown, onChanged: controller.searchUserWithCoolDown,