cipher_vault 1.1.3
cipher_vault: ^1.1.3 copied to clipboard
A Flutter widget that animates concealed text and reveals a secret.
Table of Contents #
About the Project #
Cipher Vault displays animated concealed text while a secret is unavailable, then transitions to the revealed value when it becomes available.
Important
Cipher Vault provides a visual effect only. It does not encrypt, protect, or securely store secrets.
Features #
- Animated concealed text with configurable length and refresh rate
- Smooth transition from concealed text to a selectable secret
- Custom animation alphabets with Unicode grapheme support
- Optional trailing widget displayed after reveal, such as a copy button
- Configurable replacement frequency and reveal attempts
- Support for Android, iOS, web, Windows, macOS, and Linux
How to Use #
Pass null while the secret is concealed, then provide the secret to reveal
it:
CipherVault(
secret: isSecretAvailable ? 'My secret' : null,
)
After the reveal animation finishes, the secret becomes selectable and the
optional buttonCopy widget is shown:
CipherVault(
secret: 'My secret',
buttonCopy: IconButton(
onPressed: copySecret,
icon: const Icon(Icons.copy),
),
)
Configuration #
Use CipherVaultConfig to customize the alphabet, generated text length, and
animation timing:
const CipherVault(
secret: 'Мой секрет',
textStyle: TextStyle(fontSize: 18),
config: CipherVaultConfig(
alphabetCipherVault: 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя',
minLengthCipherVault: 10,
maxLengthCipherVault: 20,
updateAnimationUpdate: Duration(milliseconds: 80),
updatePasswordAnimationUpdate: Duration(milliseconds: 60),
),
)
| Option | Default | Description |
|---|---|---|
alphabetCipherVault |
Letters, digits, and symbols | Characters used by the animation |
minLengthCipherVault |
7 |
Minimum generated concealed-text length |
maxLengthCipherVault |
16 |
Maximum generated concealed-text length |
updateAnimationUpdate |
100ms |
Concealed animation refresh interval |
updatePasswordAnimationUpdate |
100ms |
Reveal animation refresh interval |
showAnimationFrequency |
0.2 |
Probability of replacing a concealed character per update |
showPasswordAnimationFrequency |
0.5 |
Probability of updating a reveal character per update |
countAttemp |
5 |
Random replacements before a character is revealed |
The reveal frequency must be greater than 0, and the concealed frequency
must not be negative. Values greater than or equal to 1 update every
character on every tick. The alphabet must not be empty, and the maximum
length must be greater than or equal to the minimum length.
copyWith can be used to derive a configuration:
final fastConfig = const CipherVaultConfig().copyWith(
minLengthCipherVault: 10,
maxLengthCipherVault: 20,
updateAnimationUpdate: const Duration(milliseconds: 30),
);
How to Contribute #
Issues and pull requests are welcome. Before submitting a change, run:
flutter analyze
flutter test
cd example && flutter test
See CHANGELOG.md for release notes.