title: How to display time on buttons in Flutter
body: <p><strong>Requirement:</strong>
  I have 2 buttons, I want when I click on button 1 its text should be replaced by the current time, and the same for button 2.</p>
  <p><strong>Problem:</strong>
  The problem is when I click on button 1 its text change to the current time, but when I click on button 2 after a few minutes its text changes to the same time that button 1 has.</p>
  <p>Here is my code:</p>
  <pre><code> 
    void initState() {
      // TODO: implement initState
      super.initState();
       _getTime();
       
    }
  
    void _getTime() {
      final String formattedDateTime =
          DateFormat('kk:mm:ss').format(DateTime.now()).toString();
      setState(() {
        getTime = formattedDateTime;
       print(getTime[0]);
      });
    }
  
  var timeInText=&quot;Time in&quot;;
    var timeOutText=&quot;Time out&quot;;
  \\button 1
  RoundedButton(icon: Icon(Icons.timer,color: Colors.white),
            text:timeInText,
            bgcolor: Colors.blue[500],
            press:(){
              setState(() {
                            timeInText=getTime;
                          
                            
                          });
  
            })
  
  //button 2
  
  RoundedButton(icon: Icon(Icons.timer,color: Colors.white),
            text:timeoutText,
            bgcolor: Colors.blue[500],
            press:(){
              setState(() {
                            timeoutText=getTime;
                           
                          });
  
            })
            
  </code></pre>
  <p>please help to fix it. thanks</p>