I search a simple solution to pass simple string variable over the tree widget, inherite function is to complicated to me.
to resume :
I tried to pass data to page 1 to body of page 2
class page1 extends StatefulWidget
string textvariable
onPressed: () {
Navigator.push(
context,
new MaterialPageRoute(builder: (context) => new page2(
textvariable: this,
)),
);
},
in my next page I have a StatelessWidget
class page2 extends StatelessWidget {
var textvariable;
page2({this.textvariable});
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: AppBar(title: const Text("Localisation")),
body: testwidget (textvariable),
);
}
}
I try to passe textvariable in the widget 3 who is a stateful
class testwidget extends StatefulWidget
...
new Text(
"$textvariable",
),