feat: view type stored in view/cubit, itself, cleanup coe

This commit is contained in:
Anton Stubenbord
2023-02-10 12:41:30 +01:00
parent e65e152d44
commit f04edece16
72 changed files with 307 additions and 568 deletions

View File

@@ -63,25 +63,48 @@ class _ClientCertificateFormFieldState
),
child: Column(
children: [
ListTile(
leading: ElevatedButton(
onPressed: () => _onSelectFile(field),
child: Text(S.of(context).genericActionSelectText),
),
title: _buildSelectedFileText(field),
trailing: AbsorbPointer(
absorbing: field.value == null,
child: _selectedFile != null
? IconButton(
icon: const Icon(Icons.close),
onPressed: () => setState(() {
_selectedFile = null;
field.didChange(null);
}),
)
: null,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
ElevatedButton(
onPressed: () => _onSelectFile(field),
child:
Text(S.of(context).genericActionSelectText),
),
_buildSelectedFileText(field).paddedOnly(left: 8),
],
),
if (_selectedFile != null)
IconButton(
icon: const Icon(Icons.close),
onPressed: () => setState(() {
_selectedFile = null;
field.didChange(null);
}),
)
],
).padded(8),
// ListTile(
// leading: ElevatedButton(
// onPressed: () => _onSelectFile(field),
// child: Text(S.of(context).genericActionSelectText),
// ),
// title: _buildSelectedFileText(field),
// trailing: AbsorbPointer(
// absorbing: field.value == null,
// child: _selectedFile != null
// ? IconButton(
// icon: const Icon(Icons.close),
// onPressed: () => setState(() {
// _selectedFile = null;
// field.didChange(null);
// }),
// )
// : null,
// ),
// ),
if (_selectedFile != null) ...[
ObscuredInputTextFormField(
key: const ValueKey('login-client-cert-passphrase'),
@@ -127,7 +150,9 @@ class _ClientCertificateFormFieldState
assert(_selectedFile == null);
return Text(
S.of(context).loginPageClientCertificateSettingSelectFileText,
style: TextStyle(color: Theme.of(context).hintColor),
style: Theme.of(context).textTheme.labelMedium?.apply(
color: Theme.of(context).hintColor,
),
);
} else {
assert(_selectedFile != null);