I'm new to Flutter! I want to change the content of "Text" on click and Button "change Text" see the following code:
void main() {
runApp(MaterialApp(home: MyHomePage()));
}
class MyHomePage extends StatelessWidget {
const MyHomePage({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.blue,
title: Center(
child: Text("App demo",
style: TextStyle(color: Colors.yellow, fontSize: 40))),
),
body:Center(
child: Column(children: [
Text("Hello word !", key: Key("textKey")),
TextButton(child: Text("change Text"), onPressed: (){
/* **I want to change "Hello word!" to "Text has changed"** */
debugPrint("Change");
},),
],),
)
),
);
}
}
