diff --git a/lib/pages/search/public_room/empty_search_public_room_widget.dart b/lib/pages/search/public_room/empty_search_public_room_widget.dart index e4181bbfa6..e6409221c9 100644 --- a/lib/pages/search/public_room/empty_search_public_room_widget.dart +++ b/lib/pages/search/public_room/empty_search_public_room_widget.dart @@ -18,47 +18,44 @@ class EmptySearchPublicRoomWidget extends StatelessWidget { Widget build(BuildContext context) { return Padding( padding: SearchPublicRoomViewStyle.paddingListItem, - child: Padding( - padding: SearchPublicRoomViewStyle.paddingInsideListItem, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: SearchPublicRoomViewStyle.paddingAvatar, - child: Avatar( - name: genericSearchTerm, - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: SearchPublicRoomViewStyle.paddingAvatar, + child: Avatar( + name: genericSearchTerm, ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - genericSearchTerm, - overflow: TextOverflow.ellipsis, - maxLines: 1, - softWrap: false, - style: SearchPublicRoomViewStyle.roomNameTextStyle, + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + genericSearchTerm, + overflow: TextOverflow.ellipsis, + maxLines: 1, + softWrap: false, + style: SearchPublicRoomViewStyle.roomNameTextStyle, + ), + const SizedBox( + height: SearchPublicRoomViewStyle.nameToButtonSpace, + ), + TwakeTextButton( + message: L10n.of(context)!.joinRoom, + styleMessage: + SearchPublicRoomViewStyle.joinButtonLabelStyle(context), + paddingAll: SearchPublicRoomViewStyle.paddingButton, + onTap: onTapJoin, + buttonDecoration: + SearchPublicRoomViewStyle.actionButtonDecoration( + context, ), - const SizedBox( - height: SearchPublicRoomViewStyle.nameToButtonSpace, - ), - TwakeTextButton( - message: L10n.of(context)!.joinRoom, - styleMessage: - SearchPublicRoomViewStyle.joinButtonLabelStyle(context), - paddingAll: SearchPublicRoomViewStyle.paddingButton, - onTap: onTapJoin, - buttonDecoration: - SearchPublicRoomViewStyle.actionButtonDecoration( - context, - ), - ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), ); } diff --git a/lib/pages/search/public_room/search_public_room_view.dart b/lib/pages/search/public_room/search_public_room_view.dart index 081eb822cf..229ace5e1a 100644 --- a/lib/pages/search/public_room/search_public_room_view.dart +++ b/lib/pages/search/public_room/search_public_room_view.dart @@ -52,56 +52,62 @@ class SearchPublicRoomList extends StatelessWidget { .getAction(context, room); return Padding( padding: SearchPublicRoomViewStyle.paddingListItem, - child: Padding( - padding: SearchPublicRoomViewStyle.paddingInsideListItem, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Padding( - padding: SearchPublicRoomViewStyle.paddingAvatar, - child: Avatar( - mxContent: room.avatarUrl, - name: room.name, - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: SearchPublicRoomViewStyle.paddingAvatar, + child: Avatar( + mxContent: room.avatarUrl, + name: room.name, + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + room.name ?? room.roomId, + overflow: TextOverflow.ellipsis, + maxLines: 1, + softWrap: false, + style: + SearchPublicRoomViewStyle.roomNameTextStyle, + ), + const SizedBox( + height: + SearchPublicRoomViewStyle.nameToButtonSpace, + ), + Text( + room.canonicalAlias ?? room.roomId, + overflow: TextOverflow.ellipsis, + maxLines: 1, + softWrap: false, + style: + SearchPublicRoomViewStyle.roomAliasTextStyle, + ), + ], ), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - room.name ?? room.roomId, - overflow: TextOverflow.ellipsis, - maxLines: 1, - softWrap: false, - style: - SearchPublicRoomViewStyle.roomNameTextStyle, - ), - const SizedBox( - height: - SearchPublicRoomViewStyle.nameToButtonSpace, - ), - if (action != null) - TwakeTextButton( - message: action.getLabel(context), - styleMessage: action.getLabelStyle(context), - paddingAll: - SearchPublicRoomViewStyle.paddingButton, - onTap: () => searchController - .searchPublicRoomController - .handlePublicRoomActions( - context, - room, - action, - ), - hoverColor: Colors.transparent, - buttonDecoration: SearchPublicRoomViewStyle - .actionButtonDecoration(context), - ), - ], + ), + if (action != null) + TwakeTextButton( + message: action.getLabel(context), + styleMessage: action.getLabelStyle(context), + paddingAll: SearchPublicRoomViewStyle.paddingButton, + onTap: () => searchController + .searchPublicRoomController + .handlePublicRoomActions( + context, + room, + action, + ), + hoverColor: Colors.transparent, + buttonDecoration: + SearchPublicRoomViewStyle.actionButtonDecoration( + context, ), ), - ], - ), + ], ), ); }), diff --git a/lib/pages/search/public_room/search_public_room_view_style.dart b/lib/pages/search/public_room/search_public_room_view_style.dart index 5685747deb..5bc2b59344 100644 --- a/lib/pages/search/public_room/search_public_room_view_style.dart +++ b/lib/pages/search/public_room/search_public_room_view_style.dart @@ -8,13 +8,17 @@ class SearchPublicRoomViewStyle { static const double paddingButton = 12.0; - static const EdgeInsetsGeometry paddingListItem = EdgeInsets.all(8.0); - - static const EdgeInsetsGeometry paddingInsideListItem = EdgeInsets.all(8.0); + static const EdgeInsetsGeometry paddingListItem = EdgeInsets.all(16.0); static const EdgeInsetsGeometry paddingAvatar = EdgeInsets.only(right: 12.0); static TextStyle roomNameTextStyle = + LinagoraTextStyle.material().bodyMedium2.copyWith( + color: LinagoraSysColors.material().onSurface, + fontFamily: GoogleFonts.inter().fontFamily, + ); + + static TextStyle roomAliasTextStyle = LinagoraTextStyle.material().bodyMedium3.copyWith( color: LinagoraSysColors.material().onSurface, fontFamily: GoogleFonts.inter().fontFamily, diff --git a/test/utils/string_extension_test.dart b/test/utils/string_extension_test.dart index fe60a49bbc..719d9a9305 100644 --- a/test/utils/string_extension_test.dart +++ b/test/utils/string_extension_test.dart @@ -392,11 +392,7 @@ void main() { for (final entry in testMap.entries) { test('Testing: ${entry.key} => Expected: ${entry.value}', () { final result = entry.key.isRoomAlias(); - if (entry.value) { - expect(result, isTrue); - } else { - expect(result, isFalse); - } + expect(result, entry.value); }); } }); @@ -430,11 +426,7 @@ void main() { for (final entry in testMap.entries) { test('Testing: ${entry.key} => Expected: ${entry.value}', () { final result = entry.key.isRoomId(); - if (entry.value) { - expect(result, isTrue); - } else { - expect(result, isFalse); - } + expect(result, entry.value); }); } });