mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-14 05:52:51 +00:00
Added access control settings
This commit is contained in:
parent
c78ae81122
commit
e8d3e14245
9 changed files with 621 additions and 297 deletions
152
lib/screens/settings/access_settings.dart
Normal file
152
lib/screens/settings/access_settings.dart
Normal file
|
@ -0,0 +1,152 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/screens/settings/clients_list.dart';
|
||||
|
||||
import 'package:adguard_home_manager/services/http_requests.dart';
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
import 'package:adguard_home_manager/providers/servers_provider.dart';
|
||||
|
||||
class AccessSettings extends StatelessWidget {
|
||||
const AccessSettings({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final serversProvider = Provider.of<ServersProvider>(context);
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
return AccessSettingsWidget(
|
||||
serversProvider: serversProvider,
|
||||
appConfigProvider: appConfigProvider,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AccessSettingsWidget extends StatefulWidget {
|
||||
final ServersProvider serversProvider;
|
||||
final AppConfigProvider appConfigProvider;
|
||||
|
||||
const AccessSettingsWidget({
|
||||
Key? key,
|
||||
required this.serversProvider,
|
||||
required this.appConfigProvider,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AccessSettingsWidget> createState() => _AccessSettingsWidgetState();
|
||||
}
|
||||
|
||||
class _AccessSettingsWidgetState extends State<AccessSettingsWidget> with TickerProviderStateMixin {
|
||||
final ScrollController scrollController = ScrollController();
|
||||
late TabController tabController;
|
||||
|
||||
Future fetchClients() async {
|
||||
widget.serversProvider.setClientsLoadStatus(0, false);
|
||||
final result = await getClients(widget.serversProvider.selectedServer!);
|
||||
if (mounted) {
|
||||
if (result['result'] == 'success') {
|
||||
widget.serversProvider.setClientsData(result['data']);
|
||||
widget.serversProvider.setClientsLoadStatus(1, true);
|
||||
}
|
||||
else {
|
||||
widget.appConfigProvider.addLog(result['log']);
|
||||
widget.serversProvider.setClientsLoadStatus(2, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
fetchClients();
|
||||
super.initState();
|
||||
tabController = TabController(
|
||||
initialIndex: 0,
|
||||
length: 3,
|
||||
vsync: this,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final serversProvider = Provider.of<ServersProvider>(context);
|
||||
|
||||
return Scaffold(
|
||||
body: DefaultTabController(
|
||||
length: 3,
|
||||
child: NestedScrollView(
|
||||
controller: scrollController,
|
||||
headerSliverBuilder: ((context, innerBoxIsScrolled) {
|
||||
return [
|
||||
SliverAppBar(
|
||||
title: Text(AppLocalizations.of(context)!.accessSettings),
|
||||
pinned: true,
|
||||
floating: true,
|
||||
forceElevated: innerBoxIsScrolled,
|
||||
bottom: TabBar(
|
||||
controller: tabController,
|
||||
tabs: [
|
||||
Tab(
|
||||
icon: const Icon(Icons.check),
|
||||
text: AppLocalizations.of(context)!.allowedClients,
|
||||
),
|
||||
Tab(
|
||||
icon: const Icon(Icons.block),
|
||||
text: AppLocalizations.of(context)!.disallowedClients,
|
||||
),
|
||||
Tab(
|
||||
icon: const Icon(Icons.link_rounded),
|
||||
text: AppLocalizations.of(context)!.disallowedDomains,
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
];
|
||||
}),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? const Color.fromRGBO(220, 220, 220, 1)
|
||||
: const Color.fromRGBO(50, 50, 50, 1)
|
||||
)
|
||||
)
|
||||
),
|
||||
child: TabBarView(
|
||||
controller: tabController,
|
||||
children: [
|
||||
ClientsList(
|
||||
type: 'allowed',
|
||||
scrollController: scrollController,
|
||||
loadStatus: serversProvider.clients.loadStatus,
|
||||
data: serversProvider.clients.loadStatus == 1
|
||||
? serversProvider.clients.data!.clientsAllowedBlocked!.allowedClients : [],
|
||||
fetchClients: fetchClients
|
||||
),
|
||||
ClientsList(
|
||||
type: 'disallowed',
|
||||
scrollController: scrollController,
|
||||
loadStatus: serversProvider.clients.loadStatus,
|
||||
data: serversProvider.clients.loadStatus == 1
|
||||
? serversProvider.clients.data!.clientsAllowedBlocked!.disallowedClients : [],
|
||||
fetchClients: fetchClients
|
||||
),
|
||||
ClientsList(
|
||||
type: 'domains',
|
||||
scrollController: scrollController,
|
||||
loadStatus: serversProvider.clients.loadStatus,
|
||||
data: serversProvider.clients.loadStatus == 1
|
||||
? serversProvider.clients.data!.clientsAllowedBlocked!.blockedHosts : [],
|
||||
fetchClients: fetchClients
|
||||
),
|
||||
]
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
150
lib/screens/settings/add_client_modal.dart
Normal file
150
lib/screens/settings/add_client_modal.dart
Normal file
|
@ -0,0 +1,150 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
class AddClientModal extends StatefulWidget {
|
||||
final String type;
|
||||
final void Function(String, String) onConfirm;
|
||||
|
||||
const AddClientModal({
|
||||
Key? key,
|
||||
required this.type,
|
||||
required this.onConfirm
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddClientModal> createState() => _AddClientModalState();
|
||||
}
|
||||
|
||||
class _AddClientModalState extends State<AddClientModal> {
|
||||
TextEditingController fieldController = TextEditingController();
|
||||
|
||||
bool validData = false;
|
||||
|
||||
void checkValidValues() {
|
||||
if (fieldController.text != '') {
|
||||
setState(() => validData = true);
|
||||
}
|
||||
else {
|
||||
setState(() => validData = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
IconData icon() {
|
||||
switch (widget.type) {
|
||||
case 'allowed':
|
||||
return Icons.check;
|
||||
|
||||
case 'disallowed':
|
||||
return Icons.block;
|
||||
|
||||
case 'domains':
|
||||
return Icons.link_rounded;
|
||||
|
||||
default:
|
||||
return Icons.check;
|
||||
}
|
||||
}
|
||||
|
||||
String title() {
|
||||
switch (widget.type) {
|
||||
case 'allowed':
|
||||
return AppLocalizations.of(context)!.allowClient;
|
||||
|
||||
case 'disallowed':
|
||||
return AppLocalizations.of(context)!.disallowClient;
|
||||
|
||||
case 'domains':
|
||||
return AppLocalizations.of(context)!.disallowedDomains;
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: Container(
|
||||
height: 322,
|
||||
padding: const EdgeInsets.all(28),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(28),
|
||||
topRight: Radius.circular(28)
|
||||
)
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
icon(),
|
||||
size: 26,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
title(),
|
||||
style: const TextStyle(
|
||||
fontSize: 24
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
TextFormField(
|
||||
controller: fieldController,
|
||||
onChanged: (_) => checkValidValues(),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.link_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10)
|
||||
)
|
||||
),
|
||||
helperText: widget.type == 'allowed' || widget.type == 'blocked'
|
||||
? AppLocalizations.of(context)!.addClientFieldDescription : null,
|
||||
labelText: widget.type == 'allowed' || widget.type == 'blocked'
|
||||
? AppLocalizations.of(context)!.clientIdentifier
|
||||
: AppLocalizations.of(context)!.domain,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(AppLocalizations.of(context)!.cancel)
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
TextButton(
|
||||
onPressed: validData == true
|
||||
? () {
|
||||
Navigator.pop(context);
|
||||
widget.onConfirm(fieldController.text, widget.type);
|
||||
}
|
||||
: null,
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.confirm,
|
||||
style: TextStyle(
|
||||
color: validData == true
|
||||
? Theme.of(context).primaryColor
|
||||
: Colors.grey
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
355
lib/screens/settings/clients_list.dart
Normal file
355
lib/screens/settings/clients_list.dart
Normal file
|
@ -0,0 +1,355 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/screens/settings/add_client_modal.dart';
|
||||
import 'package:adguard_home_manager/screens/clients/remove_client_modal.dart';
|
||||
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
import 'package:adguard_home_manager/models/clients_allowed_blocked.dart';
|
||||
import 'package:adguard_home_manager/providers/servers_provider.dart';
|
||||
import 'package:adguard_home_manager/services/http_requests.dart';
|
||||
import 'package:adguard_home_manager/classes/process_modal.dart';
|
||||
|
||||
class ClientsList extends StatefulWidget {
|
||||
final String type;
|
||||
final ScrollController scrollController;
|
||||
final int loadStatus;
|
||||
final List<String> data;
|
||||
final Future Function() fetchClients;
|
||||
|
||||
const ClientsList({
|
||||
Key? key,
|
||||
required this.type,
|
||||
required this.scrollController,
|
||||
required this.loadStatus,
|
||||
required this.data,
|
||||
required this.fetchClients
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ClientsList> createState() => _ClientsListState();
|
||||
}
|
||||
|
||||
class _ClientsListState extends State<ClientsList> {
|
||||
late bool isVisible;
|
||||
|
||||
@override
|
||||
initState(){
|
||||
super.initState();
|
||||
|
||||
isVisible = true;
|
||||
widget.scrollController.addListener(() {
|
||||
if (widget.scrollController.position.userScrollDirection == ScrollDirection.reverse) {
|
||||
if (mounted && isVisible == true) {
|
||||
setState(() => isVisible = false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (widget.scrollController.position.userScrollDirection == ScrollDirection.forward) {
|
||||
if (mounted && isVisible == false) {
|
||||
setState(() => isVisible = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final serversProvider = Provider.of<ServersProvider>(context);
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
void confirmRemoveItem(String client, String type) async {
|
||||
Map<String, List<String>> body = {
|
||||
"allowed_clients": serversProvider.clients.data!.clientsAllowedBlocked?.allowedClients ?? [],
|
||||
"disallowed_clients": serversProvider.clients.data!.clientsAllowedBlocked?.disallowedClients ?? [],
|
||||
"blocked_hosts": serversProvider.clients.data!.clientsAllowedBlocked?.blockedHosts ?? [],
|
||||
};
|
||||
|
||||
if (type == 'allowed') {
|
||||
body['allowed_clients'] = body['allowed_clients']!.where((c) => c != client).toList();
|
||||
}
|
||||
else if (type == 'disallowed') {
|
||||
body['disallowed_clients'] = body['disallowed_clients']!.where((c) => c != client).toList();
|
||||
}
|
||||
else if (type == 'domains') {
|
||||
body['blocked_hosts'] = body['blocked_hosts']!.where((c) => c != client).toList();
|
||||
}
|
||||
|
||||
ProcessModal processModal = ProcessModal(context: context);
|
||||
processModal.open(AppLocalizations.of(context)!.removingClient);
|
||||
|
||||
final result = await requestAllowedBlockedClientsHosts(serversProvider.selectedServer!, body);
|
||||
|
||||
processModal.close();
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
serversProvider.setAllowedDisallowedClientsBlockedDomains(
|
||||
ClientsAllowedBlocked(
|
||||
allowedClients: body['allowed_clients'] ?? [],
|
||||
disallowedClients: body['disallowed_clients'] ?? [],
|
||||
blockedHosts: body['blocked_hosts'] ?? [],
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (result['result'] == 'error' && result['message'] == 'client_another_list') {
|
||||
appConfigProvider.setShowingSnackbar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.clientAnotherList),
|
||||
backgroundColor: Colors.red,
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
appConfigProvider.addLog(result['log']);
|
||||
appConfigProvider.setShowingSnackbar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.clientNotRemoved),
|
||||
backgroundColor: Colors.red,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void confirmAddItem(String item, String type) async {
|
||||
Map<String, List<String>> body = {
|
||||
"allowed_clients": serversProvider.clients.data!.clientsAllowedBlocked?.allowedClients ?? [],
|
||||
"disallowed_clients": serversProvider.clients.data!.clientsAllowedBlocked?.disallowedClients ?? [],
|
||||
"blocked_hosts": serversProvider.clients.data!.clientsAllowedBlocked?.blockedHosts ?? [],
|
||||
};
|
||||
|
||||
if (type == 'allowed') {
|
||||
body['allowed_clients']!.add(item);
|
||||
}
|
||||
else if (type == 'disallowed') {
|
||||
body['disallowed_clients']!.add(item);
|
||||
}
|
||||
else if (type == 'domains') {
|
||||
body['blocked_hosts']!.add(item);
|
||||
}
|
||||
|
||||
ProcessModal processModal = ProcessModal(context: context);
|
||||
processModal.open(AppLocalizations.of(context)!.removingClient);
|
||||
|
||||
final result = await requestAllowedBlockedClientsHosts(serversProvider.selectedServer!, body);
|
||||
|
||||
processModal.close();
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
serversProvider.setAllowedDisallowedClientsBlockedDomains(
|
||||
ClientsAllowedBlocked(
|
||||
allowedClients: body['allowed_clients'] ?? [],
|
||||
disallowedClients: body['disallowed_clients'] ?? [],
|
||||
blockedHosts: body['blocked_hosts'] ?? [],
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (result['result'] == 'error' && result['message'] == 'client_another_list') {
|
||||
appConfigProvider.setShowingSnackbar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.clientAnotherList),
|
||||
backgroundColor: Colors.red,
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
appConfigProvider.addLog(result['log']);
|
||||
appConfigProvider.setShowingSnackbar();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
type == 'allowed' || type == 'blocked'
|
||||
? AppLocalizations.of(context)!.clientNotRemoved
|
||||
: AppLocalizations.of(context)!.domainNotAdded
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String description() {
|
||||
switch (widget.type) {
|
||||
case 'allowed':
|
||||
return AppLocalizations.of(context)!.allowedClientsDescription;
|
||||
|
||||
case 'disallowed':
|
||||
return AppLocalizations.of(context)!.blockedClientsDescription;
|
||||
|
||||
case 'domains':
|
||||
return AppLocalizations.of(context)!.disallowedDomainsDescription;
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
String noItems() {
|
||||
switch (widget.type) {
|
||||
case 'allowed':
|
||||
return AppLocalizations.of(context)!.noAllowedClients;
|
||||
|
||||
case 'disallowed':
|
||||
return AppLocalizations.of(context)!.noBlockedClients;
|
||||
|
||||
case 'domains':
|
||||
return AppLocalizations.of(context)!.noDisallowedDomains;
|
||||
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
switch (widget.loadStatus) {
|
||||
case 0:
|
||||
return SizedBox(
|
||||
width: double.maxFinite,
|
||||
height: MediaQuery.of(context).size.height-171,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.loadingClients,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
color: Colors.grey,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
case 1:
|
||||
return Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.info_rounded),
|
||||
const SizedBox(width: 20),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width-112,
|
||||
child: Text(description()),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.data.isNotEmpty) Expanded(
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 0),
|
||||
itemCount: widget.data.length,
|
||||
itemBuilder: (context, index) => ListTile(
|
||||
title: Text(widget.data[index]),
|
||||
trailing: IconButton(
|
||||
onPressed: () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => RemoveClientModal(
|
||||
onConfirm: () => confirmRemoveItem(widget.data[index], widget.type),
|
||||
)
|
||||
)
|
||||
},
|
||||
icon: const Icon(Icons.delete_rounded)
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
if (widget.data.isEmpty) Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
noItems(),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
color: Colors.grey
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
TextButton.icon(
|
||||
onPressed: widget.fetchClients,
|
||||
icon: const Icon(Icons.refresh_rounded),
|
||||
label: Text(AppLocalizations.of(context)!.refresh),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: isVisible ?
|
||||
appConfigProvider.showingSnackbar
|
||||
? 70 : 20
|
||||
: -70,
|
||||
right: 20,
|
||||
child: FloatingActionButton(
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => AddClientModal(
|
||||
type: widget.type,
|
||||
onConfirm: confirmAddItem
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
isScrollControlled: true
|
||||
);
|
||||
},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
)
|
||||
]
|
||||
);
|
||||
|
||||
case 2:
|
||||
return 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)!.clientsNotLoaded,
|
||||
style: const TextStyle(
|
||||
fontSize: 22,
|
||||
color: Colors.grey,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||
import 'package:adguard_home_manager/screens/settings/theme_modal.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/custom_list_tile.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/server_info.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/access_settings.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/section_label.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/appbar.dart';
|
||||
import 'package:adguard_home_manager/screens/servers/servers.dart';
|
||||
|
@ -85,6 +86,18 @@ class Settings extends StatelessWidget {
|
|||
body: ListView(
|
||||
children: [
|
||||
SectionLabel(label: AppLocalizations.of(context)!.serverSettings),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.lock_rounded,
|
||||
label: AppLocalizations.of(context)!.accessSettings,
|
||||
description: AppLocalizations.of(context)!.accessSettingsDescription,
|
||||
onTap: () => {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AccessSettings()
|
||||
)
|
||||
)
|
||||
},
|
||||
),
|
||||
CustomListTile(
|
||||
leadingIcon: Icons.info_rounded,
|
||||
label: AppLocalizations.of(context)!.serverInformation,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue