I have a container in which there are 2 fields. 1 is a percentage and the other is simple Text. What I need is I don't want to show the percentage container and when I click on the container it will show the percentage for 3 seconds only and then disappear, Can anyone please tell how it's possible?
Here is my code
int size = _questions.length;
void nextQuestion(){
if(index < size - 1)
setState(() {
index++;
});
print(index);
}
double percentage1Calculate(){
int wouldClick = int.parse(_questions[index]['wouldclick']);
int ratherClick = int.parse(_questions[index]['ratherclick']);
double percentage1 = wouldClick / (wouldClick + ratherClick) * 100;
return percentage1;
}
GestureDetector(
child: Container(
height: stackHeight * 0.5,
width: stackWidth,
color: Colors.blue,
child: Column(
children: <Widget>[
Container(
padding: const EdgeInsets.only(top: 10, right: 10),
height: stackHeight * 0.1,
color: Colors.blue,
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text('${percentage1Calculate().toStringAsFixed(0)}%',
style: TextStyle(
color: Colors.white,
fontSize: 23,
fontFamily: 'NewsCycle',
),
),
],
)
),
Container(
color: Colors.blue,
height: stackHeight * 0.4,
width: double.infinity,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text(
_questions[index]['would'],
style: TextStyle(
color: Colors.white,
fontSize: 23,
fontFamily: 'NewsCycle',
),
),
),
],
)
),
],
),
),
),
As in code i have wrapped a container in GestureDetector. And in container i have 2 container. both are showing text. What i need is when user click on gesturedetector then the 1st container show the value and after 3 seconds it will hide.