mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-22 23:09:12 +00:00
Changed how search clients works
This commit is contained in:
parent
f126d052c0
commit
ea3606b762
3 changed files with 19 additions and 10 deletions
|
@ -569,5 +569,6 @@
|
|||
"doNotRememberAgainUpdate": "Do not remember again for this version",
|
||||
"downloadingUpdate": "Downloading",
|
||||
"completed": "completed",
|
||||
"permissionNotGranted": "Permission not granted"
|
||||
"permissionNotGranted": "Permission not granted",
|
||||
"inputSearchTerm": "Input a search term."
|
||||
}
|
|
@ -569,5 +569,6 @@
|
|||
"doNotRememberAgainUpdate": "No recordar de nuevo para esta actualización",
|
||||
"downloadingUpdate": "Descargando",
|
||||
"completed": "completado",
|
||||
"permissionNotGranted": "Permiso no concedido"
|
||||
"permissionNotGranted": "Permiso no concedido",
|
||||
"inputSearchTerm": "Introduce un término de búsqueda."
|
||||
}
|
|
@ -58,11 +58,19 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
|||
bool showDivider = true;
|
||||
|
||||
void search(String value) {
|
||||
if (value == '') {
|
||||
setState(() {
|
||||
clientsScreen = [];
|
||||
autoClientsScreen = [];
|
||||
});
|
||||
}
|
||||
else {
|
||||
setState(() {
|
||||
clientsScreen = clients.where((client) => client.name.contains(value) || client.ids.where((e) => e.contains(value)).isNotEmpty).toList();
|
||||
autoClientsScreen = autoClients.where((client) => (client.name != null ? client.name!.contains(value) : true) || client.ip.contains(value)).toList();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void scrollListener() {
|
||||
if (scrollController.position.pixels > 0) {
|
||||
|
@ -80,9 +88,6 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
|||
setState(() {
|
||||
clients = widget.serversProvider.clients.data!.clients;
|
||||
autoClients = widget.serversProvider.clients.data!.autoClientsData;
|
||||
|
||||
clientsScreen = widget.serversProvider.clients.data!.clients;
|
||||
autoClientsScreen = widget.serversProvider.clients.data!.autoClientsData;
|
||||
});
|
||||
|
||||
super.initState();
|
||||
|
@ -377,7 +382,9 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
|||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.noClientsSearch,
|
||||
searchController.text == ''
|
||||
? AppLocalizations.of(context)!.inputSearchTerm
|
||||
: AppLocalizations.of(context)!.noClientsSearch,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.grey,
|
||||
|
|
Loading…
Add table
Reference in a new issue