Fix indexing error in conversation list search. #516
|
@ -314,4 +314,8 @@ class ContactInfoState extends ChangeNotifier {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
// returns true only if the conversation has been accepted, and has not been blocked
|
||||
bool isAccepted() {
|
||||
return _accepted && !_blocked;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,11 +227,11 @@ class _ContactsViewState extends State<ContactsView> {
|
|||
|
||||
var contactList = ScrollablePositionedList.separated(
|
||||
itemScrollController: Provider.of<ProfileInfoState>(context).contactListScrollController,
|
||||
itemCount: Provider.of<ContactListState>(context).num,
|
||||
itemCount: Provider.of<ContactListState>(context).numFiltered,
|
||||
initialScrollIndex: initialScroll,
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
semanticChildCount: Provider.of<ContactListState>(context).num,
|
||||
semanticChildCount: Provider.of<ContactListState>(context).numFiltered,
|
||||
itemBuilder: (context, index) {
|
||||
return tiles.elementAt(index);
|
||||
},
|
||||
|
|
|
@ -19,7 +19,6 @@ class ContactRow extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ContactRowState extends State<ContactRow> {
|
||||
|
||||
bool isHover = false;
|
||||
|
||||
@override
|
||||
|
@ -127,12 +126,15 @@ class _ContactRowState extends State<ContactRow> {
|
|||
),
|
||||
],
|
||||
))),
|
||||
|
||||
Visibility(visible: Platform.isAndroid || (!Platform.isAndroid && isHover) || contact.pinned, child:
|
||||
IconButton(
|
||||
Visibility(
|
||||
// only allow pinning for non-blocked and accepted conversations,
|
||||
visible: contact.isAccepted() && (Platform.isAndroid || (!Platform.isAndroid && isHover) || contact.pinned),
|
||||
child: IconButton(
|
||||
tooltip: contact.pinned ? AppLocalizations.of(context)!.tooltipUnpinConversation : AppLocalizations.of(context)!.tooltipPinConversation,
|
||||
icon: Icon(contact.pinned ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
color: Provider.of<Settings>(context).theme.mainTextColor,),
|
||||
icon: Icon(
|
||||
contact.pinned ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
color: Provider.of<Settings>(context).theme.mainTextColor,
|
||||
),
|
||||
onPressed: () {
|
||||
if (contact.pinned) {
|
||||
contact.unpin(context);
|
||||
|
|
Loading…
Reference in New Issue