Skip to content

Commit

Permalink
TW-1592: go to setting profile when clicking to own contact
Browse files Browse the repository at this point in the history
  • Loading branch information
Te-Z committed Apr 8, 2024
1 parent 93deff6 commit 622fcf0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
37 changes: 28 additions & 9 deletions lib/pages/search/recent_item_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import 'package:fluffychat/pages/search/recent_item_widget_style.dart';
import 'package:fluffychat/presentation/extensions/room_summary_extension.dart';
import 'package:fluffychat/presentation/extensions/search/presentation_search_extensions.dart';
import 'package:fluffychat/presentation/model/search/presentation_search.dart';
import 'package:fluffychat/utils/string_extension.dart';
import 'package:fluffychat/widgets/avatar/avatar.dart';
import 'package:fluffychat/widgets/highlight_text.dart';
import 'package:fluffychat/widgets/twake_components/twake_chip.dart';
import 'package:flutter/material.dart' hide SearchController;
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:linagora_design_flutter/linagora_design_flutter.dart';
Expand Down Expand Up @@ -253,16 +255,33 @@ class _ContactInformation extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_SearchHighlightText(
text: contactPresentationSearch.displayName ?? "",
style: Theme.of(context).textTheme.titleMedium?.merge(
TextStyle(
overflow: TextOverflow.ellipsis,
letterSpacing: 0.15,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
Row(
children: [
Expanded(
child: _SearchHighlightText(
text: contactPresentationSearch.displayName ?? "",
style: Theme.of(context).textTheme.titleMedium?.merge(
TextStyle(
overflow: TextOverflow.ellipsis,
letterSpacing: 0.15,
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
),
),
searchWord: searchKeyword,
),
searchWord: searchKeyword,
),
if (contactPresentationSearch.matrixId != null &&
contactPresentationSearch.matrixId!
.isCurrentMatrixId(context)) ...[
const SizedBox(width: 8.0),
TwakeChip(
text: L10n.of(context)!.owner,
textColor: Theme.of(context).colorScheme.primary,
),
],
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
8 changes: 8 additions & 0 deletions lib/pages/search/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,20 @@ class SearchController extends State<Search> {

void onSearchItemTap(PresentationSearch presentationSearch) async {
if (presentationSearch is ContactPresentationSearch) {
if (presentationSearch.matrixId?.isCurrentMatrixId(context) == true) {
goToSettingsProfile();
return;
}
onContactTap(presentationSearch);
} else if (presentationSearch is RecentChatPresentationSearch) {
onRecentChatTap(presentationSearch);
}
}

void goToSettingsProfile() async {
context.go('/rooms/profile');
}

void onContactTap(ContactPresentationSearch contactPresentationSearch) {
final roomId = Matrix.of(context)
.client
Expand Down

0 comments on commit 622fcf0

Please sign in to comment.