I want to hide a text widget visibility on the click of a button using Visibility widget. How can I achieve this in Flutter? I have created a function which accepts a bool variable which defines the visibility of the Text Widget. On the click of the button, I am calling that function. For the first time, the text is shown to the user. But on the click of the button, the text is not invisible.
//created a method to show and hide the text using visibility widget
hideTextVisibility(bool visibilityStatus){
return visibilityStatus? Visibility(
visible: visibilityStatus,
child: Text("flutter"),
):Container();}
//button click code and for the first time the text will be visible
RaisedButton(onPressed: (){
setState(() {
hideTextVisibility(false);
});