diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index 5bd3897d..cbb27a61 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -87,18 +87,7 @@ class _ContactsViewState extends State { child: Text("%1 ยป %2".replaceAll("%1", Provider.of(context).nickname).replaceAll("%2", AppLocalizations.of(context)!.titleManageContacts), overflow: TextOverflow.ellipsis, style: TextStyle(color: Provider.of(context).current().mainTextColor()))), ])), - actions: [ - IconButton(icon: TorIcon(), onPressed: _pushTorStatus), - IconButton( - // need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset - icon: Icon(showSearchBar || Provider.of(context).isFiltered ? Icons.search_off : Icons.search), - onPressed: () { - Provider.of(context, listen: false).filter = ""; - setState(() { - showSearchBar = !showSearchBar; - }); - }) - ], + actions: getActions(context), ), floatingActionButton: FloatingActionButton( onPressed: _pushAddContact, @@ -107,6 +96,24 @@ class _ContactsViewState extends State { ), body: showSearchBar || Provider.of(context).isFiltered ? _buildFilterable() : _buildContactList()); } + + List getActions(context) { + var actions = List.empty(growable: true); + if (Provider.of(context).blockUnknownConnections ) { + actions.add(Tooltip(message: AppLocalizations.of(context)!.blockUnknownConnectionsEnabledDescription, child: Icon(CwtchIcons.block_unknown))); + } + actions.add( IconButton(icon: TorIcon(), onPressed: _pushTorStatus),); + actions.add(IconButton( + // need both conditions for displaying initial empty textfield and also allowing filters to be cleared if this widget gets lost/reset + icon: Icon(showSearchBar || Provider.of(context).isFiltered ? Icons.search_off : Icons.search), + onPressed: () { + Provider.of(context, listen: false).filter = ""; + setState(() { + showSearchBar = !showSearchBar; + }); + })); + return actions; + } Widget _buildFilterable() { Widget txtfield = CwtchTextField(