Change padding and marginals

This commit is contained in:
Dennis Fokin 2023-07-13 16:06:21 +02:00
parent c764eb1ab5
commit 9a27b8f45e
No known key found for this signature in database
GPG Key ID: 870B88256690D8BC

View File

@ -69,92 +69,88 @@ class _ListScreenState extends ConsumerState<ListScreen> {
child: //Padding( child: //Padding(
//padding: const EdgeInsets.symmetric(horizontal: 18.0), //padding: const EdgeInsets.symmetric(horizontal: 18.0),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0), padding: const EdgeInsets.symmetric(horizontal: 18.0),
child: Text(l10n.l_select_accounts)), child: Text(l10n.l_select_accounts)),
const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)), //const Padding(padding: EdgeInsets.symmetric(vertical: 8.0)),
...widget.credentialsFromUri!.map( ...widget.credentialsFromUri!.map(
(cred) => CheckboxListTile( (cred) => CheckboxListTile(
//contentPadding: const EdgeInsets.fromLTRB(0.0, 12.0, 0.0, 16.0), //contentPadding: const EdgeInsets.fromLTRB(0.0, 12.0, 0.0, 16.0),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
secondary: Row(mainAxisSize: MainAxisSize.min, children: [ secondary: Row(mainAxisSize: MainAxisSize.min, children: [
IconButton( IconButton(
isSelected: touchEnabled[cred], isSelected: touchEnabled[cred],
color: touchEnabled[cred]! ? Colors.green : null, color: touchEnabled[cred]! ? Colors.green : null,
onPressed: () { onPressed: () {
setState(() { setState(() {
touchEnabled[cred] = !touchEnabled[cred]!; touchEnabled[cred] = !touchEnabled[cred]!;
}); });
}, },
icon: const Icon(Icons.touch_app_outlined)), icon: const Icon(Icons.touch_app_outlined)),
IconButton( IconButton(
onPressed: () async { onPressed: () async {
final node = ref final node = ref
.watch(currentDeviceDataProvider) .watch(currentDeviceDataProvider)
.valueOrNull .valueOrNull
?.node; ?.node;
final withContext = ref.read(withContextProvider); final withContext = ref.read(withContextProvider);
CredentialData renamed = await withContext( CredentialData renamed = await withContext(
(context) async => await showBlurDialog( (context) async => await showBlurDialog(
context: context, context: context,
builder: (context) => RenameList( builder: (context) => RenameList(node!, cred,
node!, widget.credentialsFromUri, _credentials),
cred, ));
widget.credentialsFromUri,
_credentials),
));
setState(() { setState(() {
int index = widget.credentialsFromUri!.indexWhere( int index = widget.credentialsFromUri!.indexWhere(
(element) => (element) =>
element.name == cred.name && element.name == cred.name &&
(element.issuer == cred.issuer)); (element.issuer == cred.issuer));
widget.credentialsFromUri![index] = renamed; widget.credentialsFromUri![index] = renamed;
checkedCreds[cred] = false; checkedCreds[cred] = false;
checkedCreds[renamed] = true; checkedCreds[renamed] = true;
touchEnabled[renamed] = false; touchEnabled[renamed] = false;
}); });
}, },
icon: const Icon(Icons.edit_outlined)), icon: const Icon(Icons.edit_outlined)),
]), ]),
title: cred.issuer != null title:
? Text(cred.issuer!) cred.issuer != null ? Text(cred.issuer!) : Text(cred.name),
: Text(cred.name), value: isUnique(cred) ? (checkedCreds[cred] ?? true) : false,
value: isUnique(cred) ? (checkedCreds[cred] ?? true) : false, enabled: isUnique(cred),
enabled: isUnique(cred), subtitle: cred.issuer != null
subtitle: cred.issuer != null ? Wrap(children: [
? Wrap(children: [ Text(cred.name),
Text(cred.name), isUnique(cred)
isUnique(cred) ? Text('')
? Text('') : Text(
: Text( l10n.l_name_already_exists,
l10n.l_name_already_exists, style: TextStyle(color: Colors.red),
style: TextStyle(color: Colors.red), )
) ])
]) : isUnique(cred)
: isUnique(cred) ? null
? null : Text(
: Text( l10n.l_name_already_exists,
l10n.l_name_already_exists, style: TextStyle(color: Colors.red),
style: TextStyle(color: Colors.red), ),
), onChanged: (bool? value) {
onChanged: (bool? value) { setState(() {
setState(() { checkedCreds[cred] = value!;
checkedCreds[cred] = value!; });
}); },
}, ),
), )
) ]
] .map((e) => Padding(
/* .map((e) => Padding( padding: const EdgeInsets.symmetric(vertical: 8.0),
padding: const EdgeInsets.symmetric(vertical: 8.0), child: e,
child: e, ))
)) .toList(),
.toList(),*/ ));
));
} }
bool areUnique() { bool areUnique() {