mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-30 16:29:30 +01:00
chore: Enhance invitiation UX
This commit is contained in:
parent
d25d8cc1c2
commit
c420343db9
@ -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);
|
||||||
|
|
||||||
|
@ -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(
|
||||||
|
@ -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(
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user