I declared a class, returned MaterialApp and used button in it also used Navigator.Push method for navigation to different page, but it gave exception
Navigator operation requested with a context that does not include a Navigator
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
SafeArea(
child: Scaffold(
backgroundColor: Colors.red[100],
body:Column(
children: [
SizedBox(height: 50,),
Align(
alignment:Alignment.center,
child:Image.asset("assets/icons/appicon.png",
height:150),
),
Align(
alignment: Alignment.bottomCenter,
child: RaisedButton(
child: Text('Click Picture'),
color: Colors.red[800],
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CameraRoute()
),
);
},
),
)
],
),
),
)
);
//throw UnimplementedError();
}
}