I'm trying to encrypt or decrypt a string depending on whether I press a button or not. The algorithm works because on my console I get the right result: once the button is pressed, the decrypted text is shown as I want. But this change is not shown on the screen, in fact the encrypted text remains and does not undergo any changes. How can I make sure that once the 'Show Word List' button is pressed, my text changes to show the decrypted text?
I show below my code:
String seedphrase = state.seedphrase;
bool seedphraseforCrypted = true;
if(SettingsPage.passwordCreated == true && seedphraseforCrypted == true) {
seedphrase = AesEncryptionDecryption
.encryptAES(
seedphrase)
.base64;
}
void decryptWordList() {
setState(() {
seedphrase = AesEncryptionDecryption.decryptAES(
seedphrase);
});
seedphraseforCrypted = false;
}
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: seedphrase,
style: GoogleFonts.encodeSansSemiCondensed(fontSize: 18.0, fontWeight: FontWeight.w400,color: Palette.textColor)
),
WidgetSpan(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Icon(
FeatherIcons.copy,
size: 25,
),
),
),
],
),
),
RoundedButton(
text: 'Show Word List',
selected: true,
onPressed: () {
decryptWordList();
},
),
does anyone know how to help me? thank you !