xxxxxxxxxx
// this is to place the Secondpage ontop of the first page
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondPage()),
);
// This is to replace the first page with the second page
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => SecondPage()),
);
xxxxxxxxxx
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondRoute()),
);
}