Skip to content

Commit

Permalink
TW-2144 Update search result list item
Browse files Browse the repository at this point in the history
  • Loading branch information
KhaledNjim committed Dec 11, 2024
1 parent d1e36f3 commit cafbd79
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 74 deletions.
8 changes: 4 additions & 4 deletions lib/pages/chat_search/chat_search_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ class ChatSearchStyle {
EdgeInsetsDirectional.only(start: 8, top: 16, bottom: 16, end: 16);

static const EdgeInsetsGeometry itemMargin =
EdgeInsetsDirectional.symmetric(horizontal: 16);
EdgeInsetsDirectional.symmetric(horizontal: 8);

static const EdgeInsetsGeometry itemPadding =
EdgeInsetsDirectional.only(end: 8);
EdgeInsetsDirectional.only(end: 8, top: 8);

static const EdgeInsetsGeometry avatarPadding =
EdgeInsetsDirectional.symmetric(horizontal: 8, vertical: 16);
EdgeInsetsDirectional.symmetric(horizontal: 8, vertical: 8);

static const EdgeInsetsGeometry emptyPadding = EdgeInsetsDirectional.all(16);

static const double emptyGap = 128.0;

static const double itemHeight = 90.0;
static const double itemHeight = 80.0;

static const double itemBorderRadius = 12.0;
}
109 changes: 51 additions & 58 deletions lib/pages/chat_search/chat_search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ class _ServerSearchView extends StatelessWidget {
return CustomScrollView(
controller: controller.scrollController,
slivers: [
const SliverToBoxAdapter(
child: SizedBox(
height: 8,
),
),
ValueListenableBuilder(
valueListenable: serverSearchController.searchResultsNotifier,
builder: (context, searchResults, child) {
Expand Down Expand Up @@ -196,74 +201,62 @@ class _SearchItem extends StatelessWidget {
future: event.fetchSenderUser(),
builder: (context, snapshot) {
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
return Padding(
return Container(
padding: ChatSearchStyle.itemMargin,
child: InkWell(
hoverColor: LinagoraRefColors.material().primary[99],
borderRadius:
BorderRadius.circular(ChatSearchStyle.itemBorderRadius),
height: ChatSearchStyle.itemHeight,
child: TwakeInkWell(
onTap: () => onTap(event),
child: Row(
children: [
Padding(
padding: ChatSearchStyle.avatarPadding,
child: Avatar(
mxContent: user.avatarUrl,
name: user.calcDisplayname(),
),
),
Expanded(
child: Container(
margin: ChatSearchStyle.itemPadding,
height: ChatSearchStyle.itemHeight,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: LinagoraRefColors.material().tertiary[60] ??
Colors.black,
width: 1,
),
),
child: TwakeListItem(
child: Row(
children: [
Padding(
padding: ChatSearchStyle.avatarPadding,
child: Avatar(
mxContent: user.avatarUrl,
name: user.calcDisplayname(),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Expanded(
child: Text(
user.id == Matrix.of(context).client.userID
? L10n.of(context)!.you
: user.calcDisplayname(),
maxLines: 1,
),
Expanded(
child: Container(
margin: ChatSearchStyle.itemPadding,
height: ChatSearchStyle.itemHeight,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: Text(
user.id == Matrix.of(context).client.userID
? L10n.of(context)!.you
: user.calcDisplayname(),
maxLines: 1,
style: ListItemStyle.titleTextStyle(
fontFamily: 'Inter',
),
),
),
Text(
event.originServerTs
.localizedTimeShort(context),
style: Theme.of(context)
.textTheme
.bodyLarge
.labelMedium
?.copyWith(
color: LinagoraSysColors.material()
.onSurface,
color: LinagoraRefColors.material()
.tertiary[30],
),
),
),
Text(
event.originServerTs.localizedTimeShort(context),
style: Theme.of(context)
.textTheme
.labelMedium
?.copyWith(
color:
LinagoraSysColors.material().onSurface,
),
),
],
),
_MessageContent(event: event, searchWord: searchWord),
],
],
),
_MessageContent(event: event, searchWord: searchWord),
],
),
),
),
),
],
],
),
),
),
);
Expand Down
9 changes: 3 additions & 6 deletions lib/pages/new_private_chat/widget/expansion_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import 'package:fluffychat/presentation/model/contact/presentation_contact_succe
import 'package:fluffychat/utils/responsive/responsive_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:linagora_design_flutter/colors/linagora_ref_colors.dart';

import 'package:fluffychat/pages/new_private_chat/widget/expansion_contact_list_tile.dart';
import 'package:fluffychat/pages/new_private_chat/widget/no_contacts_found.dart';
import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart';
import 'package:linagora_design_flutter/linagora_design_flutter.dart';

class ExpansionList extends StatelessWidget {
final ValueNotifier<Either<Failure, Success>> presentationContactsNotifier;
Expand Down Expand Up @@ -88,14 +87,13 @@ class ExpansionList extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
..._buildResponsiveButtons(context),
InkWell(
TwakeInkWell(
onTap: () {
onContactTap(
context,
success.contact,
);
},
borderRadius: BorderRadius.circular(16.0),
child: ExpansionContactListTile(
contact: success.contact,
highlightKeyword: textEditingController.text,
Expand Down Expand Up @@ -138,14 +136,13 @@ class ExpansionList extends StatelessWidget {
physics: const NeverScrollableScrollPhysics(),
itemCount: contacts.length,
itemBuilder: (context, index) {
return InkWell(
return TwakeInkWell(
onTap: () {
onContactTap(
context,
contacts[index],
);
},
borderRadius: BorderRadius.circular(16.0),
child: ExpansionContactListTile(
contact: contacts[index],
highlightKeyword: textEditingController.text,
Expand Down
11 changes: 5 additions & 6 deletions lib/pages/search/server_search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:fluffychat/pages/chat_list/chat_list_item_title.dart';
import 'package:fluffychat/widgets/matrix.dart';
import 'package:fluffychat/widgets/search/empty_search_widget.dart';
import 'package:flutter/material.dart' hide SearchController;
import 'package:linagora_design_flutter/linagora_design_flutter.dart';
import 'package:matrix/matrix.dart';

class ServerSearchMessagesList extends StatelessWidget {
Expand Down Expand Up @@ -54,12 +55,10 @@ class ServerSearchMessagesList extends StatelessWidget {
final event = Event.fromMatrixEvent(searchResult, room);
final originServerTs = searchResult.originServerTs;

return Padding(
padding: ServerSearchViewStyle.paddingListItem,
child: InkWell(
onTap: () =>
context.goToRoomWithEvent(event.room.id, event.eventId),
borderRadius: ServerSearchViewStyle.itemBorderRadius,
return TwakeInkWell(
onTap: () =>
context.goToRoomWithEvent(event.room.id, event.eventId),
child: TwakeListItem(
child: Padding(
padding: ServerSearchViewStyle.paddingInsideListItem,
child: Row(
Expand Down

0 comments on commit cafbd79

Please sign in to comment.