dimanche 3 mai 2020

How to change the UI if the value of a variable changes?

I tried to change the UI if (variable1 == "1"), but I get an error. Can anybody tell me what is wrong with my code or if there is another way to show the user something different if variable1 changes the value? Below is the code I tried. Thanks in advance.

    return Scaffold(

      body: Container(
        if (variable1 == "1") {
        child: Center(
          child: Text("Test");
        ),
       }
        else {
          print("test");
        }
      ),
    );
  }
}

Aucun commentaire:

Enregistrer un commentaire