mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-06-03 05:10:17 +00:00
Changed system navigation bar color
This commit is contained in:
parent
83ea589187
commit
b164d520db
47 changed files with 3370 additions and 3207 deletions
|
@ -283,376 +283,378 @@ class _EncryptionSettingsState extends State<EncryptionSettings> {
|
|||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
body: Builder(
|
||||
builder: (context) {
|
||||
switch (loadStatus) {
|
||||
case LoadStatus.loading:
|
||||
return SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.loadingEncryptionSettings,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
case LoadStatus.loaded:
|
||||
return ListView(
|
||||
children: [
|
||||
EncryptionMasterSwitch(
|
||||
value: enabled,
|
||||
onChange: (value) {
|
||||
setState(() => enabled = value);
|
||||
onEditValidate();
|
||||
}
|
||||
),
|
||||
SectionLabel(
|
||||
label: AppLocalizations.of(context)!.serverConfiguration,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
),
|
||||
EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: domainNameController,
|
||||
icon: Icons.link_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => domainError = validateDomain(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: domainError,
|
||||
label: AppLocalizations.of(context)!.domainName,
|
||||
helperText: AppLocalizations.of(context)!.domainNameDescription,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
CustomSwitchListTile(
|
||||
value: redirectHttps,
|
||||
onChanged: (value) {
|
||||
setState(() => redirectHttps = value);
|
||||
onEditValidate();
|
||||
},
|
||||
title: AppLocalizations.of(context)!.redirectHttps,
|
||||
disabled: !enabled,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
body: SafeArea(
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
switch (loadStatus) {
|
||||
case LoadStatus.loading:
|
||||
return SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
FractionallySizedBox(
|
||||
widthFactor: width > 900 ? 0.33 : 1,
|
||||
child: EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: httpsPortController,
|
||||
icon: Icons.numbers_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => httpsPortError = validatePort(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: httpsPortError,
|
||||
label: AppLocalizations.of(context)!.httpsPort,
|
||||
keyboardType: TextInputType.number,
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.loadingEncryptionSettings,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: width <= 900
|
||||
? const EdgeInsets.symmetric(vertical: 24)
|
||||
: const EdgeInsets.all(0),
|
||||
child: FractionallySizedBox(
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
case LoadStatus.loaded:
|
||||
return ListView(
|
||||
children: [
|
||||
EncryptionMasterSwitch(
|
||||
value: enabled,
|
||||
onChange: (value) {
|
||||
setState(() => enabled = value);
|
||||
onEditValidate();
|
||||
}
|
||||
),
|
||||
SectionLabel(
|
||||
label: AppLocalizations.of(context)!.serverConfiguration,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
),
|
||||
EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: domainNameController,
|
||||
icon: Icons.link_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => domainError = validateDomain(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: domainError,
|
||||
label: AppLocalizations.of(context)!.domainName,
|
||||
helperText: AppLocalizations.of(context)!.domainNameDescription,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
CustomSwitchListTile(
|
||||
value: redirectHttps,
|
||||
onChanged: (value) {
|
||||
setState(() => redirectHttps = value);
|
||||
onEditValidate();
|
||||
},
|
||||
title: AppLocalizations.of(context)!.redirectHttps,
|
||||
disabled: !enabled,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Wrap(
|
||||
children: [
|
||||
FractionallySizedBox(
|
||||
widthFactor: width > 900 ? 0.33 : 1,
|
||||
child: EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: tlsPortController,
|
||||
controller: httpsPortController,
|
||||
icon: Icons.numbers_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => tlsPortError = validatePort(context, value));
|
||||
setState(() => httpsPortError = validatePort(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: tlsPortError,
|
||||
label: AppLocalizations.of(context)!.tlsPort,
|
||||
errorText: httpsPortError,
|
||||
label: AppLocalizations.of(context)!.httpsPort,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
),
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: width > 900 ? 0.33 : 1,
|
||||
child: EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: dnsOverQuicPortController,
|
||||
icon: Icons.numbers_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => dnsOverQuicPortError = validatePort(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: dnsOverQuicPortError,
|
||||
label: AppLocalizations.of(context)!.dnsOverQuicPort,
|
||||
keyboardType: TextInputType.number,
|
||||
Padding(
|
||||
padding: width <= 900
|
||||
? const EdgeInsets.symmetric(vertical: 24)
|
||||
: const EdgeInsets.all(0),
|
||||
child: FractionallySizedBox(
|
||||
widthFactor: width > 900 ? 0.33 : 1,
|
||||
child: EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: tlsPortController,
|
||||
icon: Icons.numbers_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => tlsPortError = validatePort(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: tlsPortError,
|
||||
label: AppLocalizations.of(context)!.tlsPort,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
),
|
||||
),
|
||||
FractionallySizedBox(
|
||||
widthFactor: width > 900 ? 0.33 : 1,
|
||||
child: EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: dnsOverQuicPortController,
|
||||
icon: Icons.numbers_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => dnsOverQuicPortError = validatePort(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
errorText: dnsOverQuicPortError,
|
||||
label: AppLocalizations.of(context)!.dnsOverQuicPort,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SectionLabel(
|
||||
label: AppLocalizations.of(context)!.certificates,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_rounded,
|
||||
color: Theme.of(context).listTileTheme.iconColor,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Flexible(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.certificatesDescription,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SectionLabel(
|
||||
label: AppLocalizations.of(context)!.certificates,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info_rounded,
|
||||
color: Theme.of(context).listTileTheme.iconColor,
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
Flexible(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.certificatesDescription,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
RadioListTile(
|
||||
value: 0,
|
||||
groupValue: certificateOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => certificateOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.certificateFilePath,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
),
|
||||
RadioListTile(
|
||||
value: 1,
|
||||
groupValue: certificateOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => certificateOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.pasteCertificateContent,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (certificateOption == 0) EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: certificatePathController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => certificatePathError = validatePath(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.certificatePath,
|
||||
errorText: certificatePathError,
|
||||
),
|
||||
if (certificateOption == 1) EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: certificateContentController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => certificateContentError = validateCertificate(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.certificateContent,
|
||||
errorText: certificateContentError,
|
||||
multiline: true,
|
||||
keyboardType: TextInputType.multiline,
|
||||
),
|
||||
if (certKeyValid != null && (certificateContentController.text != '' || certificatePathController.text != '')) ...[
|
||||
const SizedBox(height: 20),
|
||||
if (certKeyValid!.validChain != null) ...[
|
||||
Status(
|
||||
valid: certKeyValid!.validChain ?? false,
|
||||
label: certKeyValid!.validChain == true
|
||||
? AppLocalizations.of(context)!.validCertificateChain
|
||||
: AppLocalizations.of(context)!.invalidCertificateChain,
|
||||
RadioListTile(
|
||||
value: 0,
|
||||
groupValue: certificateOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => certificateOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.certificateFilePath,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.subject != null) ...[
|
||||
Status(
|
||||
),
|
||||
RadioListTile(
|
||||
value: 1,
|
||||
groupValue: certificateOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => certificateOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.pasteCertificateContent,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (certificateOption == 0) EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: certificatePathController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => certificatePathError = validatePath(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.certificatePath,
|
||||
errorText: certificatePathError,
|
||||
),
|
||||
if (certificateOption == 1) EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: certificateContentController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => certificateContentError = validateCertificate(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.certificateContent,
|
||||
errorText: certificateContentError,
|
||||
multiline: true,
|
||||
keyboardType: TextInputType.multiline,
|
||||
),
|
||||
if (certKeyValid != null && (certificateContentController.text != '' || certificatePathController.text != '')) ...[
|
||||
const SizedBox(height: 20),
|
||||
if (certKeyValid!.validChain != null) ...[
|
||||
Status(
|
||||
valid: certKeyValid!.validChain ?? false,
|
||||
label: certKeyValid!.validChain == true
|
||||
? AppLocalizations.of(context)!.validCertificateChain
|
||||
: AppLocalizations.of(context)!.invalidCertificateChain,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.subject != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.subject}: ${certKeyValid?.subject}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.issuer != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.subject}: ${certKeyValid?.subject}"
|
||||
label: "${AppLocalizations.of(context)!.issuer}: ${certKeyValid?.issuer}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.notAfter != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.expirationDate}: ${certKeyValid?.notAfter}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.dnsNames != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.hostNames}: ${certKeyValid?.dnsNames?.join(', ')}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
],
|
||||
if (certKeyValid!.issuer != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.issuer}: ${certKeyValid?.issuer}"
|
||||
SectionLabel(
|
||||
label: AppLocalizations.of(context)!.privateKey,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.notAfter != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.expirationDate}: ${certKeyValid?.notAfter}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (certKeyValid!.dnsNames != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.hostNames}: ${certKeyValid?.dnsNames?.join(', ')}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
],
|
||||
SectionLabel(
|
||||
label: AppLocalizations.of(context)!.privateKey,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
|
||||
),
|
||||
RadioListTile(
|
||||
value: 0,
|
||||
groupValue: privateKeyOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => privateKeyOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.privateKeyFile,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
RadioListTile(
|
||||
value: 0,
|
||||
groupValue: privateKeyOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => privateKeyOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.privateKeyFile,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
RadioListTile(
|
||||
value: 1,
|
||||
groupValue: privateKeyOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => privateKeyOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.pastePrivateKey,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
RadioListTile(
|
||||
value: 1,
|
||||
groupValue: privateKeyOption,
|
||||
onChanged: enabled == true
|
||||
? (value) {
|
||||
setState(() => privateKeyOption = int.parse(value.toString()));
|
||||
onEditValidate();
|
||||
}
|
||||
: null,
|
||||
title: Text(
|
||||
AppLocalizations.of(context)!.pastePrivateKey,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.normal
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (privateKeyOption == 0) const SizedBox(height: 10),
|
||||
if (privateKeyOption == 1) ...[
|
||||
CustomSwitchListTile(
|
||||
value: usePreviouslySavedKey,
|
||||
onChanged: (value) => setState(() => usePreviouslySavedKey = value),
|
||||
title: AppLocalizations.of(context)!.usePreviousKey,
|
||||
),
|
||||
const SizedBox(height: 10)
|
||||
],
|
||||
if (privateKeyOption == 0) EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: privateKeyPathController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => privateKeyPathError = validatePath(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.privateKeyPath,
|
||||
errorText: privateKeyPathError,
|
||||
),
|
||||
if (privateKeyOption == 1) EncryptionTextField(
|
||||
enabled: enabled == true
|
||||
? !usePreviouslySavedKey
|
||||
: false,
|
||||
controller: pastePrivateKeyController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => pastePrivateKeyError = validatePrivateKey(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.pastePrivateKey,
|
||||
errorText: pastePrivateKeyError,
|
||||
keyboardType: TextInputType.multiline,
|
||||
multiline: true,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (certKeyValid != null && (privateKeyPathController.text != '' || pastePrivateKeyController.text != '' || usePreviouslySavedKey == true)) ...[
|
||||
if (certKeyValid!.validKey != null) ...[
|
||||
Status(
|
||||
valid: certKeyValid!.validKey ?? false,
|
||||
label: certKeyValid!.validKey == true
|
||||
? AppLocalizations.of(context)!.validPrivateKey
|
||||
: AppLocalizations.of(context)!.invalidPrivateKey,
|
||||
if (privateKeyOption == 0) const SizedBox(height: 10),
|
||||
if (privateKeyOption == 1) ...[
|
||||
CustomSwitchListTile(
|
||||
value: usePreviouslySavedKey,
|
||||
onChanged: (value) => setState(() => usePreviouslySavedKey = value),
|
||||
title: AppLocalizations.of(context)!.usePreviousKey,
|
||||
),
|
||||
const SizedBox(height: 10)
|
||||
],
|
||||
if (certKeyValid!.validPair != null && certKeyValid!.validPair == false) ...[
|
||||
Status(
|
||||
valid: false,
|
||||
label: AppLocalizations.of(context)!.keysNotMatch,
|
||||
),
|
||||
const SizedBox(height: 10)
|
||||
],
|
||||
if (certKeyValid!.keyType != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.keyType}: ${certKeyValid!.keyType}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
const SizedBox(height: 10)
|
||||
]
|
||||
],
|
||||
);
|
||||
|
||||
case LoadStatus.error:
|
||||
return SizedBox(
|
||||
width: double.maxFinite,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.error,
|
||||
color: Colors.red,
|
||||
size: 50,
|
||||
if (privateKeyOption == 0) EncryptionTextField(
|
||||
enabled: enabled,
|
||||
controller: privateKeyPathController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => privateKeyPathError = validatePath(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.privateKeyPath,
|
||||
errorText: privateKeyPathError,
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.encryptionSettingsNotLoaded,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
if (privateKeyOption == 1) EncryptionTextField(
|
||||
enabled: enabled == true
|
||||
? !usePreviouslySavedKey
|
||||
: false,
|
||||
controller: pastePrivateKeyController,
|
||||
icon: Icons.description_rounded,
|
||||
onChanged: (value) {
|
||||
setState(() => pastePrivateKeyError = validatePrivateKey(context, value));
|
||||
onEditValidate();
|
||||
},
|
||||
label: AppLocalizations.of(context)!.pastePrivateKey,
|
||||
errorText: pastePrivateKeyError,
|
||||
keyboardType: TextInputType.multiline,
|
||||
multiline: true,
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (certKeyValid != null && (privateKeyPathController.text != '' || pastePrivateKeyController.text != '' || usePreviouslySavedKey == true)) ...[
|
||||
if (certKeyValid!.validKey != null) ...[
|
||||
Status(
|
||||
valid: certKeyValid!.validKey ?? false,
|
||||
label: certKeyValid!.validKey == true
|
||||
? AppLocalizations.of(context)!.validPrivateKey
|
||||
: AppLocalizations.of(context)!.invalidPrivateKey,
|
||||
),
|
||||
const SizedBox(height: 10)
|
||||
],
|
||||
if (certKeyValid!.validPair != null && certKeyValid!.validPair == false) ...[
|
||||
Status(
|
||||
valid: false,
|
||||
label: AppLocalizations.of(context)!.keysNotMatch,
|
||||
),
|
||||
const SizedBox(height: 10)
|
||||
],
|
||||
if (certKeyValid!.keyType != null) ...[
|
||||
Status(
|
||||
valid: true,
|
||||
label: "${AppLocalizations.of(context)!.keyType}: ${certKeyValid!.keyType}"
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
const SizedBox(height: 10)
|
||||
]
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
case LoadStatus.error:
|
||||
return SizedBox(
|
||||
width: double.maxFinite,
|
||||
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)!.encryptionSettingsNotLoaded,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue