onTap it prints value but setState doesnt makes any difference in UI and im using it in a stateful widget and inside build too, i couldnt get where im making mistake, and im using flutter beta.
Widget build(BuildContext context) {
String text = "HEY";
void bb(){
print('Clicked Clicked');
setState(() {
text = "HEY2";
});
}
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(image: new AssetImage("assets/floor.jpg"), fit: BoxFit.cover,),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Text(
'HELLO, WORLD!',
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
textScaleFactor: 6,),
),
Divider(height: 80),
GestureDetector(
onTap: (){
bb();
},
child: Text(text, style: TextStyle(color: Colors.red)),
),
],),
)
);
}