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