Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
home: Scaffold(
body: Container(
padding: EdgeInsets.fromLTRB(10.0, 50.0, 10.0, 10.0),
child: Column(
children: [
TextField(
controller: user,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0)),
hintText: "ENTER USER NAME"),
),
SizedBox(
height: 10.0,
),
TextField(
controller: pass,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20.0)),
hintText: "ENTER USER NAME"),
),
FlatButton(
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Home()));
},
child: Text("NAVIGATOR"))
],
),
),
),
);
}
getting error in navigator.push
"This is the error I am getting while on the press" The following assertion was thrown while handling a gesture:
Navigator operation requested with a context that does not include a Navigator.The context used to push or pop routes from the Navigator must be that of a widget that is a descendant of a Navigator widget.