Skip to content

Commit

Permalink
fixup! fix: Highlight keyword when search contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
drminh2807 committed Sep 29, 2023
1 parent 25a1434 commit 8bda270
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/pages/new_group/widget/contacts_selection_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:dartz/dartz.dart';
import 'package:fluffychat/app_state/failure.dart';
import 'package:fluffychat/app_state/success.dart';
import 'package:fluffychat/pages/new_group/widget/contacts_selection_list_style.dart';
import 'package:fluffychat/presentation/model/presentation_contact.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -31,7 +32,7 @@ class ContactsSelectionList extends StatelessWidget {
valueListenable: contactsNotifier,
builder: (context, value, child) => value.fold(
(failure) => Padding(
padding: const EdgeInsets.only(left: 8.0),
padding: ContactsSelectionListStyle.notFoundPadding,
child: NoContactsFound(
keyword: failure is GetContactsFailure ? failure.keyword : '',
),
Expand All @@ -42,7 +43,7 @@ class ContactsSelectionList extends StatelessWidget {
selectedContactsMapNotifier: selectedContactsMapNotifier,
onSelectedContact: onSelectedContact,
contact: success.contact,
paddingTop: 8,
paddingTop: ContactsSelectionListStyle.listPaddingTop,
);
}
if (success is! PresentationContactsSuccess) {
Expand All @@ -51,7 +52,7 @@ class ContactsSelectionList extends StatelessWidget {

if (success.keyword.isNotEmpty && success.data.isEmpty) {
return Padding(
padding: const EdgeInsets.only(left: 8.0),
padding: ContactsSelectionListStyle.notFoundPadding,
child: NoContactsFound(
keyword: success.keyword,
),
Expand All @@ -73,7 +74,8 @@ class ContactsSelectionList extends StatelessWidget {
onSelectedContact: onSelectedContact,
highlightKeyword: success.keyword,
disabled: disabled,
paddingTop: index == 0 ? 8.0 : 0,
paddingTop:
index == 0 ? ContactsSelectionListStyle.listPaddingTop : 0,
);
},
);
Expand Down
6 changes: 6 additions & 0 deletions lib/pages/new_group/widget/contacts_selection_list_style.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'package:flutter/widgets.dart';

class ContactsSelectionListStyle {
static const notFoundPadding = EdgeInsetsDirectional.only(start: 8.0);
static const listPaddingTop = 8.0;
}

0 comments on commit 8bda270

Please sign in to comment.