From 9a27b8f45ee6eea0fe393c0e647c274d68346d5f Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Thu, 13 Jul 2023 16:06:21 +0200 Subject: [PATCH] Change padding and marginals --- lib/oath/views/list_screen.dart | 166 ++++++++++++++++---------------- 1 file changed, 81 insertions(+), 85 deletions(-) diff --git a/lib/oath/views/list_screen.dart b/lib/oath/views/list_screen.dart index 12cbf5ac..219ffabd 100644 --- a/lib/oath/views/list_screen.dart +++ b/lib/oath/views/list_screen.dart @@ -69,92 +69,88 @@ class _ListScreenState extends ConsumerState { 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() {