mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-25 11:22:23 +00:00
AppBar bottom line disappears when scroll on search clients
This commit is contained in:
parent
0853d5114b
commit
a39c43202d
1 changed files with 19 additions and 1 deletions
|
@ -46,6 +46,8 @@ class SearchClientsWidget extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
|
late ScrollController scrollController;
|
||||||
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
List<Client> clients = [];
|
List<Client> clients = [];
|
||||||
|
@ -54,6 +56,8 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
List<Client> clientsScreen = [];
|
List<Client> clientsScreen = [];
|
||||||
List<AutoClient> autoClientsScreen = [];
|
List<AutoClient> autoClientsScreen = [];
|
||||||
|
|
||||||
|
bool showDivider = true;
|
||||||
|
|
||||||
void search(String value) {
|
void search(String value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
clientsScreen = clients.where((client) => client.name.contains(value) || client.ids.where((e) => e.contains(value)).isNotEmpty).toList();
|
clientsScreen = clients.where((client) => client.name.contains(value) || client.ids.where((e) => e.contains(value)).isNotEmpty).toList();
|
||||||
|
@ -61,8 +65,19 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void scrollListener() {
|
||||||
|
if (scrollController.position.pixels > 0) {
|
||||||
|
setState(() => showDivider = false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setState(() => showDivider = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
scrollController = ScrollController()..addListener(scrollListener);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
clients = widget.serversProvider.clients.data!.clients;
|
clients = widget.serversProvider.clients.data!.clients;
|
||||||
autoClients = widget.serversProvider.clients.data!.autoClientsData;
|
autoClients = widget.serversProvider.clients.data!.autoClientsData;
|
||||||
|
@ -243,13 +258,16 @@ class _SearchClientsWidgetState extends State<SearchClientsWidget> {
|
||||||
width: double.maxFinite,
|
width: double.maxFinite,
|
||||||
height: 1,
|
height: 1,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.grey.withOpacity(0.5)
|
color: showDivider == true
|
||||||
|
? Colors.grey.withOpacity(0.5)
|
||||||
|
: Colors.transparent
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: clientsScreen.isNotEmpty || autoClientsScreen.isNotEmpty
|
body: clientsScreen.isNotEmpty || autoClientsScreen.isNotEmpty
|
||||||
? ListView(
|
? ListView(
|
||||||
|
controller: scrollController,
|
||||||
children: [
|
children: [
|
||||||
if (clientsScreen.isNotEmpty) ...[
|
if (clientsScreen.isNotEmpty) ...[
|
||||||
SectionLabel(
|
SectionLabel(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue