mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-24 02:33:44 +03:00
Animate OATH code view resizes.
This commit is contained in:
parent
ba2e5be021
commit
daba41bbfd
@ -81,40 +81,45 @@ class AccountDialog extends ConsumerWidget with AccountMixin {
|
||||
borderRadius: const BorderRadius.all(Radius.circular(30.0)),
|
||||
border: Border.all(width: 1.0, color: Colors.grey.shade500),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 8.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: code == null
|
||||
? [
|
||||
const Icon(Icons.touch_app, size: 36),
|
||||
const Text('', style: TextStyle(fontSize: 32.0)),
|
||||
]
|
||||
: [
|
||||
if (credential.oathType == OathType.totp) ...[
|
||||
credential.touchRequired && expired
|
||||
? const Icon(Icons.touch_app)
|
||||
: SizedBox.square(
|
||||
dimension: 32,
|
||||
child: CircleTimer(
|
||||
code.validFrom * 1000,
|
||||
code.validTo * 1000,
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 8.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: code == null
|
||||
? [
|
||||
const Icon(Icons.touch_app, size: 36),
|
||||
const Text('', style: TextStyle(fontSize: 32.0)),
|
||||
]
|
||||
: [
|
||||
if (credential.oathType == OathType.totp) ...[
|
||||
credential.touchRequired && expired
|
||||
? const Icon(Icons.touch_app)
|
||||
: SizedBox.square(
|
||||
dimension: 32,
|
||||
child: CircleTimer(
|
||||
code.validFrom * 1000,
|
||||
code.validTo * 1000,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8.0)
|
||||
],
|
||||
Opacity(
|
||||
opacity: expired ? 0.4 : 1.0,
|
||||
child: Text(
|
||||
formatCode(code),
|
||||
style: const TextStyle(
|
||||
fontSize: 32.0,
|
||||
fontFeatures: [FontFeature.tabularFigures()],
|
||||
const SizedBox(width: 8.0)
|
||||
],
|
||||
Opacity(
|
||||
opacity: expired ? 0.4 : 1.0,
|
||||
child: Text(
|
||||
formatCode(code),
|
||||
style: const TextStyle(
|
||||
fontSize: 32.0,
|
||||
fontFeatures: [
|
||||
FontFeature.tabularFigures()
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -139,46 +139,50 @@ class AccountView extends ConsumerWidget with AccountMixin {
|
||||
borderRadius: const BorderRadius.all(Radius.circular(30.0)),
|
||||
border: Border.all(width: 1.0, color: Colors.grey.shade500),
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 2.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: code == null
|
||||
? [
|
||||
Icon(
|
||||
credential.oathType == OathType.hotp
|
||||
? Icons.refresh
|
||||
: Icons.touch_app,
|
||||
size: 18,
|
||||
),
|
||||
const Text('', style: TextStyle(fontSize: 22.0)),
|
||||
]
|
||||
: [
|
||||
if (credential.oathType == OathType.totp) ...[
|
||||
credential.touchRequired && expired
|
||||
? const Icon(Icons.touch_app)
|
||||
: SizedBox.square(
|
||||
dimension: 16,
|
||||
child: CircleTimer(
|
||||
code.validFrom * 1000,
|
||||
code.validTo * 1000,
|
||||
),
|
||||
child: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0, vertical: 2.0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: code == null
|
||||
? [
|
||||
Icon(
|
||||
credential.oathType == OathType.hotp
|
||||
? Icons.refresh
|
||||
: Icons.touch_app,
|
||||
size: 18,
|
||||
),
|
||||
const Text('', style: TextStyle(fontSize: 22.0)),
|
||||
]
|
||||
: [
|
||||
if (credential.oathType == OathType.totp) ...[
|
||||
if (credential.touchRequired && expired)
|
||||
const Icon(Icons.touch_app),
|
||||
if (!expired)
|
||||
SizedBox.square(
|
||||
dimension: 16,
|
||||
child: CircleTimer(
|
||||
code.validFrom * 1000,
|
||||
code.validTo * 1000,
|
||||
),
|
||||
const SizedBox(width: 8.0)
|
||||
],
|
||||
Opacity(
|
||||
opacity: expired ? 0.4 : 1.0,
|
||||
child: Text(
|
||||
formatCode(code),
|
||||
style: const TextStyle(
|
||||
fontSize: 22.0,
|
||||
fontFeatures: [FontFeature.tabularFigures()],
|
||||
),
|
||||
const SizedBox(width: 8.0)
|
||||
],
|
||||
Opacity(
|
||||
opacity: expired ? 0.4 : 1.0,
|
||||
child: Text(
|
||||
formatCode(code),
|
||||
style: const TextStyle(
|
||||
fontSize: 22.0,
|
||||
fontFeatures: [FontFeature.tabularFigures()],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user