mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-04 12:24:47 +00:00
Added check and save encryption settings
This commit is contained in:
parent
137a976a36
commit
3a2483e9d6
7 changed files with 535 additions and 31 deletions
|
@ -1,10 +1,15 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
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/section_label.dart';
|
||||
import 'package:adguard_home_manager/screens/settings/encryption/config_error_modal.dart';
|
||||
import 'package:adguard_home_manager/widgets/custom_switch_list_tile.dart';
|
||||
|
||||
import 'package:adguard_home_manager/classes/process_modal.dart';
|
||||
import 'package:adguard_home_manager/functions/snackbar.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';
|
||||
|
@ -73,6 +78,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
final TextEditingController pastePrivateKeyController = TextEditingController();
|
||||
String? pastePrivateKeyError;
|
||||
|
||||
bool validData = false;
|
||||
String? validDataError;
|
||||
int dataValidApi = 0;
|
||||
|
||||
void fetchData({bool? showRefreshIndicator}) async {
|
||||
widget.serversProvider.setEncryptionSettingsLoadStatus(0, showRefreshIndicator ?? false);
|
||||
|
@ -80,7 +88,35 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
final result = await getEncryptionSettings(server: widget.serversProvider.selectedServer!);
|
||||
|
||||
if (mounted) {
|
||||
await checkValidDataApi();
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
setState(() {
|
||||
enabled = result['data'].enabled;
|
||||
domainNameController.text = result['data'].serverName ?? '';
|
||||
redirectHttps = result['data'].forceHttps;
|
||||
httpsPortController.text = result['data'].portHttps != null ? result['data'].portHttps.toString() : '';
|
||||
tlsPortController.text = result['data'].portDnsOverTls != null ? result['data'].portDnsOverTls.toString() : '';
|
||||
dnsOverQuicPortController.text = result['data'].portDnsOverQuic != null ? result['data'].portDnsOverQuic.toString() : '';
|
||||
if (result['data'].certificateChain != '' && result['data'].certificatePath == '') {
|
||||
certificateOption = 1;
|
||||
certificateContentController.text = result['data'].certificateChain;
|
||||
}
|
||||
else if (result['data'].certificateChain == '' && result['data'].certificatePath != '') {
|
||||
certificateOption = 0;
|
||||
certificatePathController.text = result['data'].certificatePath;
|
||||
}
|
||||
if (result['data'].privateKey != '' && result['data'].privateKeyPath == '') {
|
||||
privateKeyOption = 1;
|
||||
pastePrivateKeyController.text = result['data'].privateKey;
|
||||
}
|
||||
else if (result['data'].privateKey == '' && result['data'].privateKeyPath != '') {
|
||||
privateKeyOption = 0;
|
||||
privateKeyPathController.text = result['data'].privateKeyPath;
|
||||
}
|
||||
usePreviouslySavedKey = result['data'].privateKeySaved;
|
||||
});
|
||||
|
||||
widget.serversProvider.setEncryptionSettings(result['data']);
|
||||
widget.serversProvider.setEncryptionSettingsLoadStatus(1, true);
|
||||
}
|
||||
|
@ -91,9 +127,186 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
}
|
||||
}
|
||||
|
||||
void validateDomain(String domain) {
|
||||
RegExp regExp = RegExp(r'^([a-z0-9|-]+\.)*[a-z0-9|-]+\.[a-z]+$');
|
||||
if (regExp.hasMatch(domain)) {
|
||||
setState(() => domainError = null);
|
||||
checkValidDataApi();
|
||||
}
|
||||
else {
|
||||
setState(() => domainError = AppLocalizations.of(context)!.domainNotValid);
|
||||
}
|
||||
checkDataValid();
|
||||
}
|
||||
|
||||
void validatePort(String value, String portType) {
|
||||
if (int.tryParse(value) != null && int.parse(value) <= 65535) {
|
||||
setState(() {
|
||||
switch (portType) {
|
||||
case 'https':
|
||||
setState(() => httpsPortError = null);
|
||||
break;
|
||||
|
||||
case 'tls':
|
||||
setState(() => tlsPortError = null);
|
||||
break;
|
||||
|
||||
case 'quic':
|
||||
setState(() => dnsOverQuicPortError = null);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
checkValidDataApi();
|
||||
}
|
||||
else {
|
||||
setState(() {
|
||||
switch (portType) {
|
||||
case 'https':
|
||||
setState(() => httpsPortError = AppLocalizations.of(context)!.invalidPort);
|
||||
break;
|
||||
|
||||
case 'tls':
|
||||
setState(() => tlsPortError = AppLocalizations.of(context)!.invalidPort);
|
||||
break;
|
||||
|
||||
case 'quic':
|
||||
setState(() => dnsOverQuicPortError = AppLocalizations.of(context)!.invalidPort);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
checkDataValid();
|
||||
}
|
||||
|
||||
void validateCertificate(String cert) {
|
||||
final regExp = RegExp(r'(-{3,}(\bBEGIN CERTIFICATE\b))|(-{3,}-{3,}(\END CERTIFICATE\b)-{3,})', multiLine: true);
|
||||
if (regExp.hasMatch(cert.replaceAll('\n', ''))) {
|
||||
setState(() => certificateContentError = AppLocalizations.of(context)!.invalidCertificate);
|
||||
}
|
||||
else {
|
||||
setState(() => certificateContentError = null);
|
||||
}
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
}
|
||||
|
||||
void validatePrivateKey(String cert) {
|
||||
final regExp = RegExp(r'(-{3,}(\bBEGIN\b).*(PRIVATE KEY\b))|(-{3,}-{3,}(\bEND\b).*(PRIVATE KEY\b)-{3,})', multiLine: true);
|
||||
if (regExp.hasMatch(cert.replaceAll('\n', ''))) {
|
||||
setState(() => pastePrivateKeyError = AppLocalizations.of(context)!.invalidPrivateKey);
|
||||
}
|
||||
else {
|
||||
setState(() => pastePrivateKeyError = null);
|
||||
}
|
||||
checkValidDataApi();
|
||||
}
|
||||
|
||||
void validatePath(String cert, String item) {
|
||||
final regExp = RegExp(r'^(\/{0,1}(?!\/))[A-Za-z0-9\/\-_]+(\.([a-zA-Z]+))?$');
|
||||
if (regExp.hasMatch(cert)) {
|
||||
if (item == 'cert') {
|
||||
setState(() => certificatePathError = null);
|
||||
}
|
||||
else if (item == 'private_key') {
|
||||
setState(() => privateKeyPathError = null);
|
||||
}
|
||||
checkValidDataApi();
|
||||
}
|
||||
else {
|
||||
if (item == 'cert') {
|
||||
setState(() => certificatePathError = AppLocalizations.of(context)!.invalidPath);
|
||||
}
|
||||
else if (item == 'private_key') {
|
||||
setState(() => privateKeyPathError = AppLocalizations.of(context)!.invalidPath);
|
||||
}
|
||||
}
|
||||
checkDataValid();
|
||||
}
|
||||
|
||||
Future checkValidDataApi() async {
|
||||
setState(() => dataValidApi = 0);
|
||||
|
||||
final result = await checkEncryptionSettings(server: widget.serversProvider.selectedServer!, data: {
|
||||
"enabled": enabled,
|
||||
"server_name": domainNameController.text,
|
||||
"force_https": redirectHttps,
|
||||
"port_https": httpsPortController.text != '' ? int.parse(httpsPortController.text) : null,
|
||||
"port_dns_over_tls": tlsPortController.text != '' ? int.parse(tlsPortController.text) : null,
|
||||
"port_dns_over_quic": dnsOverQuicPortController.text != '' ? int.parse(dnsOverQuicPortController.text) : null,
|
||||
"certificate_chain": certificateContentController.text.replaceAll('\n', ''),
|
||||
"private_key": pastePrivateKeyController.text.replaceAll('\n', ''),
|
||||
"private_key_saved": usePreviouslySavedKey,
|
||||
"certificate_path": certificatePathController.text,
|
||||
"private_key_path": privateKeyPathController.text,
|
||||
});
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
setState(() {
|
||||
if (result['data']['warning_validation'] != null && result['data']['warning_validation'] != '') {
|
||||
dataValidApi = 2;
|
||||
validDataError = result['data']['warning_validation'];
|
||||
}
|
||||
else {
|
||||
dataValidApi = 1;
|
||||
validDataError = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (result['log'].resBody != null) {
|
||||
setState(() => validDataError = result['log'].resBody);
|
||||
}
|
||||
setState(() => dataValidApi = 2);
|
||||
}
|
||||
}
|
||||
|
||||
void checkDataValid() {
|
||||
if (
|
||||
domainNameController.text != '' &&
|
||||
domainError == null &&
|
||||
httpsPortController.text != '' &&
|
||||
httpsPortError == null &&
|
||||
tlsPortController.text != '' &&
|
||||
tlsPortError == null &&
|
||||
dnsOverQuicPortController.text != '' &&
|
||||
dnsOverQuicPortError == null &&
|
||||
((
|
||||
certificateOption == 0 &&
|
||||
certificatePathController.text != '' &&
|
||||
certificatePathError == null
|
||||
) || (
|
||||
certificateOption == 1 &&
|
||||
certificateContentController.text != '' &&
|
||||
certificateContentError == null
|
||||
)) &&
|
||||
((
|
||||
privateKeyOption == 0 &&
|
||||
privateKeyPathController.text != '' &&
|
||||
privateKeyPathError == null
|
||||
) || (
|
||||
privateKeyOption == 1 &&
|
||||
pastePrivateKeyController.text != '' &&
|
||||
pastePrivateKeyError == null
|
||||
))
|
||||
) {
|
||||
setState(() => validData = true);
|
||||
checkValidDataApi();
|
||||
}
|
||||
else {
|
||||
setState(() => validData = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
fetchData();
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
@ -102,6 +315,88 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
final serversProvider = Provider.of<ServersProvider>(context);
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
void saveData() async {
|
||||
ProcessModal processModal = ProcessModal(context: context);
|
||||
processModal.open(AppLocalizations.of(context)!.savingConfig);
|
||||
|
||||
final result = await saveEncryptionSettings(server: serversProvider.selectedServer!, data: {
|
||||
"enabled": enabled,
|
||||
"server_name": domainNameController.text,
|
||||
"force_https": redirectHttps,
|
||||
"port_https": int.parse(httpsPortController.text),
|
||||
"port_dns_over_tls": int.parse(tlsPortController.text),
|
||||
"port_dns_over_quic": int.parse(dnsOverQuicPortController.text),
|
||||
"certificate_chain": certificateContentController.text,
|
||||
"private_key": pastePrivateKeyController.text,
|
||||
"private_key_saved": usePreviouslySavedKey,
|
||||
"certificate_path": certificatePathController.text,
|
||||
"private_key_path": privateKeyPathController.text,
|
||||
});
|
||||
|
||||
processModal.close();
|
||||
|
||||
if (result['result'] == 'success') {
|
||||
showSnacbkar(
|
||||
context: context,
|
||||
appConfigProvider: appConfigProvider,
|
||||
label: AppLocalizations.of(context)!.encryptionConfigSaved,
|
||||
color: Colors.green
|
||||
);
|
||||
}
|
||||
else {
|
||||
appConfigProvider.addLog(result['log']);
|
||||
|
||||
showSnacbkar(
|
||||
context: context,
|
||||
appConfigProvider: appConfigProvider,
|
||||
label: AppLocalizations.of(context)!.encryptionConfigNotSaved,
|
||||
color: Colors.red
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget generateStatus() {
|
||||
if (dataValidApi == 0) {
|
||||
return const SizedBox(
|
||||
height: 25,
|
||||
width: 25,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 3,
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (dataValidApi == 1) {
|
||||
return const Icon(
|
||||
Icons.check_circle_rounded,
|
||||
color: Colors.green,
|
||||
);
|
||||
}
|
||||
else if (dataValidApi == 2) {
|
||||
return const Icon(
|
||||
Icons.cancel_rounded,
|
||||
color: Colors.red,
|
||||
);
|
||||
}
|
||||
else {
|
||||
return const SizedBox();
|
||||
}
|
||||
}
|
||||
|
||||
String generateStatusString() {
|
||||
if (dataValidApi == 0) {
|
||||
return AppLocalizations.of(context)!.validatingData;
|
||||
}
|
||||
else if (dataValidApi == 1) {
|
||||
return AppLocalizations.of(context)!.dataValid;
|
||||
}
|
||||
else if (dataValidApi == 2) {
|
||||
return AppLocalizations.of(context)!.dataNotValid;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
Widget generateBody() {
|
||||
switch (widget.serversProvider.encryptionSettings.loadStatus) {
|
||||
case 0:
|
||||
|
@ -138,7 +433,11 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
color: Theme.of(context).primaryColor.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: InkWell(
|
||||
onTap: () => setState(() => enabled = !enabled),
|
||||
onTap: () {
|
||||
setState(() => enabled = !enabled);
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
},
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
|
@ -171,7 +470,11 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
),
|
||||
Switch(
|
||||
value: enabled,
|
||||
onChanged: (value) => setState(() => enabled = value),
|
||||
onChanged: (value) {
|
||||
setState(() => enabled = value);
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
},
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
],
|
||||
|
@ -184,8 +487,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: domainNameController,
|
||||
// onChanged:
|
||||
onChanged: validateDomain,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.link_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -196,6 +500,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
errorText: domainError,
|
||||
labelText: AppLocalizations.of(context)!.domainName,
|
||||
helperText: AppLocalizations.of(context)!.domainNameDescription,
|
||||
helperStyle: TextStyle(
|
||||
color: Theme.of(context).listTileTheme.iconColor
|
||||
),
|
||||
helperMaxLines: 10
|
||||
),
|
||||
),
|
||||
|
@ -203,15 +510,21 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
const SizedBox(height: 10),
|
||||
CustomSwitchListTile(
|
||||
value: redirectHttps,
|
||||
onChanged: (value) => setState(() => redirectHttps = value),
|
||||
onChanged: (value) {
|
||||
setState(() => redirectHttps = value);
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
},
|
||||
title: AppLocalizations.of(context)!.redirectHttps,
|
||||
disabled: !enabled,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: httpsPortController,
|
||||
// onChanged:
|
||||
onChanged: (value) => validatePort(value, 'https'),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.numbers_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -229,8 +542,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: tlsPortController,
|
||||
// onChanged:
|
||||
onChanged: (value) => validatePort(value, 'tls'),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.numbers_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -248,8 +562,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: dnsOverQuicPortController,
|
||||
// onChanged:
|
||||
onChanged: (value) => validatePort(value, 'quic'),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.numbers_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -283,7 +598,13 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
RadioListTile(
|
||||
value: 0,
|
||||
groupValue: certificateOption,
|
||||
onChanged: (value) => setState(() => certificateOption = value!),
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => certificateOption = int.parse(value.toString()));
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.certificateFilePath,
|
||||
style: const TextStyle(
|
||||
|
@ -294,7 +615,13 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
RadioListTile(
|
||||
value: 1,
|
||||
groupValue: certificateOption,
|
||||
onChanged: (value) => setState(() => certificateOption = value!),
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => certificateOption = int.parse(value.toString()));
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.pasteCertificateContent,
|
||||
style: const TextStyle(
|
||||
|
@ -306,8 +633,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
if (certificateOption == 0) Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: certificatePathController,
|
||||
// onChanged:
|
||||
onChanged: (value) => validatePath(value, 'cert'),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.description_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -323,8 +651,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
if (certificateOption == 1) Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: certificateContentController,
|
||||
// onChanged:
|
||||
onChanged: validateCertificate,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.description_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -343,7 +672,13 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
RadioListTile(
|
||||
value: 0,
|
||||
groupValue: privateKeyOption,
|
||||
onChanged: (value) => setState(() => privateKeyOption = value!),
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => privateKeyOption = int.parse(value.toString()));
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.privateKeyFile,
|
||||
style: const TextStyle(
|
||||
|
@ -354,7 +689,13 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
RadioListTile(
|
||||
value: 1,
|
||||
groupValue: privateKeyOption,
|
||||
onChanged: (value) => setState(() => privateKeyOption = value!),
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => privateKeyOption = int.parse(value.toString()));
|
||||
checkDataValid();
|
||||
checkValidDataApi();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.pastePrivateKey,
|
||||
style: const TextStyle(
|
||||
|
@ -374,8 +715,9 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
if (privateKeyOption == 0) Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: enabled,
|
||||
controller: privateKeyPathController,
|
||||
// onChanged:
|
||||
onChanged: (value) => validatePath(value, 'private_key'),
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.description_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -391,9 +733,11 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
if (privateKeyOption == 1) Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: TextFormField(
|
||||
enabled: !usePreviouslySavedKey,
|
||||
enabled: enabled == true
|
||||
? !usePreviouslySavedKey
|
||||
: false,
|
||||
controller: pastePrivateKeyController,
|
||||
// onChanged:
|
||||
onChanged: validatePrivateKey,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: const Icon(Icons.description_rounded),
|
||||
border: const OutlineInputBorder(
|
||||
|
@ -445,6 +789,27 @@ class _EncryptionSettingsWidgetState extends State<EncryptionSettingsWidget> {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.encryptionSettings),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: validData == true && dataValidApi == 2 && validDataError != null
|
||||
? () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => EncryptionErrorModal(error: validDataError!)
|
||||
)
|
||||
} : null,
|
||||
icon: generateStatus(),
|
||||
tooltip: generateStatusString()
|
||||
),
|
||||
IconButton(
|
||||
onPressed: dataValidApi == 1
|
||||
? () => saveData()
|
||||
: null,
|
||||
icon: const Icon(Icons.save),
|
||||
tooltip: AppLocalizations.of(context)!.save,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
body: generateBody(),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue