How to Toggle Visibility of RichText with a Timer for resend otp functionality.

Actions & Logic

Hello Flutter community,

I'm working on a feature in my app where I need to toggle the visibility of a RichText widget with an embedded countdown timer. Here’s what I’m trying to achieve:

  1. I have a RichText widget that includes a clickable text portion, say "Resend OTP".

  2. When "Resend OTP" is clicked, the RichText widget should be hidden.

  3. Simultaneously, a countdown timer (for 1 minute) should appear.

  4. Once the countdown ends, the timer should disappear, and the RichText widget should reappear.

I am unsure how to properly toggle the visibility between the RichText and the timer. Could anyone guide me on the best way to implement this or point me toward any relevant examples or resources?

Thanks for your help!

What have you tried so far?

I have setup page state, app state a Boolean, when the richtext was clicked i was seting the state value to true, and then start timer and in timer action when timer ends i was seeting the state to false, but this didnt work, so i toggled the state instead of setting the value, now the text was swapped with timer but the timer didnt start,

Did you check FlutterFlow's Documentation for this topic?
Yes
2
4 replies