mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-14 14:02:48 +00:00
Improvements added clients list
This commit is contained in:
parent
b599debb3c
commit
6ebde52a7f
2 changed files with 148 additions and 167 deletions
|
@ -171,163 +171,158 @@ class _AddedListState extends State<AddedList> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Stack(
|
return CustomTabContentList(
|
||||||
children: [
|
loadingGenerator: () => SizedBox(
|
||||||
CustomTabContentList(
|
width: double.maxFinite,
|
||||||
loadingGenerator: () => SizedBox(
|
height: MediaQuery.of(context).size.height-171,
|
||||||
width: double.maxFinite,
|
child: Column(
|
||||||
height: MediaQuery.of(context).size.height-171,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
const CircularProgressIndicator(),
|
||||||
children: [
|
const SizedBox(height: 30),
|
||||||
const CircularProgressIndicator(),
|
Text(
|
||||||
const SizedBox(height: 30),
|
AppLocalizations.of(context)!.loadingStatus,
|
||||||
Text(
|
textAlign: TextAlign.center,
|
||||||
AppLocalizations.of(context)!.loadingStatus,
|
style: TextStyle(
|
||||||
textAlign: TextAlign.center,
|
fontSize: 22,
|
||||||
style: TextStyle(
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
fontSize: 22,
|
),
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
)
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
],
|
),
|
||||||
|
itemsCount: widget.data.length,
|
||||||
|
contentWidget: (index) => ListTile(
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||||
|
isThreeLine: true,
|
||||||
|
onLongPress: () => openOptionsModal(widget.data[index]),
|
||||||
|
onTap: () => openClientModal(widget.data[index]),
|
||||||
|
title: Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
|
child: Text(
|
||||||
|
widget.data[index].name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
itemsCount: widget.data.length,
|
),
|
||||||
contentWidget: (index) => ListTile(
|
subtitle: Column(
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
isThreeLine: true,
|
children: [
|
||||||
onLongPress: () => openOptionsModal(widget.data[index]),
|
Text(
|
||||||
onTap: () => openClientModal(widget.data[index]),
|
widget.data[index].ids.toString().replaceAll(RegExp(r'^\[|\]$'), ''),
|
||||||
title: Padding(
|
style: TextStyle(
|
||||||
padding: const EdgeInsets.only(bottom: 5),
|
color: Theme.of(context).listTileTheme.textColor
|
||||||
child: Text(
|
|
||||||
widget.data[index].name,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: Theme.of(context).colorScheme.onSurface
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: Column(
|
const SizedBox(height: 7),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Icon(
|
||||||
widget.data[index].ids.toString().replaceAll(RegExp(r'^\[|\]$'), ''),
|
Icons.filter_list_rounded,
|
||||||
style: TextStyle(
|
size: 19,
|
||||||
color: Theme.of(context).listTileTheme.textColor
|
color: widget.data[index].filteringEnabled == true
|
||||||
),
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Colors.green
|
||||||
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
|
? Colors.grey
|
||||||
|
: Colors.red,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 7),
|
const SizedBox(width: 10),
|
||||||
Row(
|
Icon(
|
||||||
children: [
|
Icons.vpn_lock_rounded,
|
||||||
Icon(
|
size: 18,
|
||||||
Icons.filter_list_rounded,
|
color: widget.data[index].safebrowsingEnabled == true
|
||||||
size: 19,
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
color: widget.data[index].filteringEnabled == true
|
? Theme.of(context).colorScheme.primary
|
||||||
? appConfigProvider.useThemeColorForStatus == true
|
: Colors.green
|
||||||
? Theme.of(context).colorScheme.primary
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
: Colors.green
|
? Colors.grey
|
||||||
: appConfigProvider.useThemeColorForStatus == true
|
: Colors.red,
|
||||||
? Colors.grey
|
),
|
||||||
: Colors.red,
|
const SizedBox(width: 10),
|
||||||
),
|
Icon(
|
||||||
const SizedBox(width: 10),
|
Icons.block,
|
||||||
Icon(
|
size: 18,
|
||||||
Icons.vpn_lock_rounded,
|
color: widget.data[index].parentalEnabled == true
|
||||||
size: 18,
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
color: widget.data[index].safebrowsingEnabled == true
|
? Theme.of(context).colorScheme.primary
|
||||||
? appConfigProvider.useThemeColorForStatus == true
|
: Colors.green
|
||||||
? Theme.of(context).colorScheme.primary
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
: Colors.green
|
? Colors.grey
|
||||||
: appConfigProvider.useThemeColorForStatus == true
|
: Colors.red,
|
||||||
? Colors.grey
|
),
|
||||||
: Colors.red,
|
const SizedBox(width: 10),
|
||||||
),
|
Icon(
|
||||||
const SizedBox(width: 10),
|
Icons.search_rounded,
|
||||||
Icon(
|
size: 19,
|
||||||
Icons.block,
|
color: widget.data[index].safesearchEnabled == true
|
||||||
size: 18,
|
? appConfigProvider.useThemeColorForStatus == true
|
||||||
color: widget.data[index].parentalEnabled == true
|
? Theme.of(context).colorScheme.primary
|
||||||
? appConfigProvider.useThemeColorForStatus == true
|
: Colors.green
|
||||||
? Theme.of(context).colorScheme.primary
|
: appConfigProvider.useThemeColorForStatus == true
|
||||||
: Colors.green
|
? Colors.grey
|
||||||
: appConfigProvider.useThemeColorForStatus == true
|
: Colors.red,
|
||||||
? Colors.grey
|
|
||||||
: Colors.red,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Icon(
|
|
||||||
Icons.search_rounded,
|
|
||||||
size: 19,
|
|
||||||
color: widget.data[index].safesearchEnabled == true
|
|
||||||
? appConfigProvider.useThemeColorForStatus == true
|
|
||||||
? Theme.of(context).colorScheme.primary
|
|
||||||
: Colors.green
|
|
||||||
: appConfigProvider.useThemeColorForStatus == true
|
|
||||||
? Colors.grey
|
|
||||||
: Colors.red,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
),
|
],
|
||||||
noData: SizedBox(
|
|
||||||
width: double.maxFinite,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!.noClientsList,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 24,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
TextButton.icon(
|
|
||||||
onPressed: widget.fetchClients,
|
|
||||||
icon: const Icon(Icons.refresh_rounded),
|
|
||||||
label: Text(AppLocalizations.of(context)!.refresh),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
errorGenerator: () => SizedBox(
|
|
||||||
width: double.maxFinite,
|
|
||||||
height: MediaQuery.of(context).size.height-171,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Icon(
|
|
||||||
Icons.error,
|
|
||||||
color: Colors.red,
|
|
||||||
size: 50,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context)!.errorLoadServerStatus,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
loadStatus: widget.loadStatus,
|
|
||||||
onRefresh: widget.fetchClients
|
|
||||||
),
|
),
|
||||||
ClientsFab(
|
),
|
||||||
isVisible: isVisible,
|
noData: SizedBox(
|
||||||
)
|
width: double.maxFinite,
|
||||||
],
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.noClientsList,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 24,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
TextButton.icon(
|
||||||
|
onPressed: widget.fetchClients,
|
||||||
|
icon: const Icon(Icons.refresh_rounded),
|
||||||
|
label: Text(AppLocalizations.of(context)!.refresh),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
errorGenerator: () => SizedBox(
|
||||||
|
width: double.maxFinite,
|
||||||
|
height: MediaQuery.of(context).size.height-171,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 50,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.errorLoadServerStatus,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
loadStatus: widget.loadStatus,
|
||||||
|
onRefresh: widget.fetchClients,
|
||||||
|
fab: const ClientsFab(),
|
||||||
|
fabVisible: isVisible,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,12 +14,7 @@ import 'package:adguard_home_manager/providers/servers_provider.dart';
|
||||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
|
|
||||||
class ClientsFab extends StatelessWidget {
|
class ClientsFab extends StatelessWidget {
|
||||||
final bool isVisible;
|
const ClientsFab({Key? key}) : super(key: key);
|
||||||
|
|
||||||
const ClientsFab({
|
|
||||||
Key? key,
|
|
||||||
required this.isVisible
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -67,18 +62,9 @@ class ClientsFab extends StatelessWidget {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return AnimatedPositioned(
|
return FloatingActionButton(
|
||||||
duration: const Duration(milliseconds: 100),
|
onPressed: openAddClient,
|
||||||
curve: Curves.easeInOut,
|
child: const Icon(Icons.add),
|
||||||
bottom: isVisible ?
|
|
||||||
appConfigProvider.showingSnackbar
|
|
||||||
? 70 : 20
|
|
||||||
: -70,
|
|
||||||
right: 20,
|
|
||||||
child: FloatingActionButton(
|
|
||||||
onPressed: openAddClient,
|
|
||||||
child: const Icon(Icons.add),
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue