From cf88eb1fd710a14e07df6b98dd6cc8a12d51699d Mon Sep 17 00:00:00 2001 From: Krille Date: Sun, 5 Feb 2023 13:08:58 +0100 Subject: [PATCH] style: Make invite page more pretty --- .../invitation_selection.dart | 2 +- .../invitation_selection_view.dart | 51 +++++++++++++------ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/lib/pages/invitation_selection/invitation_selection.dart b/lib/pages/invitation_selection/invitation_selection.dart index ab10628b..efdde84a 100644 --- a/lib/pages/invitation_selection/invitation_selection.dart +++ b/lib/pages/invitation_selection/invitation_selection.dart @@ -79,7 +79,7 @@ class InvitationSelectionController extends State { void searchUserWithCoolDown(String text) async { coolDown?.cancel(); coolDown = Timer( - const Duration(seconds: 1), + const Duration(milliseconds: 500), () => searchUser(context, text), ); } diff --git a/lib/pages/invitation_selection/invitation_selection_view.dart b/lib/pages/invitation_selection/invitation_selection_view.dart index 910ad9c1..d5288b64 100644 --- a/lib/pages/invitation_selection/invitation_selection_view.dart +++ b/lib/pages/invitation_selection/invitation_selection_view.dart @@ -28,21 +28,32 @@ class InvitationSelectionView extends StatelessWidget { .toSegments(['rooms', controller.roomId!]), ), titleSpacing: 0, - title: TextField( - autofocus: true, - decoration: InputDecoration( - hintText: L10n.of(context)!.inviteContactToGroup(groupName), - suffixIconConstraints: const BoxConstraints( - maxWidth: 48, - maxHeight: 48, - minWidth: 48, + title: SizedBox( + height: 44, + child: Padding( + padding: const EdgeInsets.only(right: 12.0), + child: TextField( + textInputAction: TextInputAction.search, + decoration: InputDecoration( + hintText: L10n.of(context)!.inviteContactToGroup(groupName), + suffixIcon: controller.loading + ? const Padding( + padding: EdgeInsets.symmetric( + vertical: 10.0, + horizontal: 12, + ), + child: SizedBox.square( + dimension: 24, + child: CircularProgressIndicator.adaptive( + strokeWidth: 2, + ), + ), + ) + : const Icon(Icons.search_outlined), + ), + onChanged: controller.searchUserWithCoolDown, ), - suffixIcon: controller.loading - ? const CircularProgressIndicator.adaptive() - : const Icon(Icons.search_outlined), - contentPadding: const EdgeInsets.symmetric(horizontal: 16), ), - onChanged: controller.searchUserWithCoolDown, ), ), body: MaxWidthBody( @@ -85,8 +96,18 @@ class InvitationSelectionView extends StatelessWidget { mxContent: contacts[i].avatarUrl, name: contacts[i].calcDisplayname(), ), - title: Text(contacts[i].calcDisplayname()), - subtitle: Text(contacts[i].id), + title: Text( + contacts[i].calcDisplayname(), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + subtitle: Text( + contacts[i].id, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Theme.of(context).colorScheme.secondary), + ), onTap: () => controller.inviteAction(context, contacts[i].id), ),