I am using the Align
widget to place an Icon button at the bottom center of the screen.
However, I get the following error and I'm unable to resolve it:
The specific widget that could not find a Material ancestor was:
IconButton
My code:
return Stack(
children: <Widget>[
Container(
child: GoogleMap(
initialCameraPosition:
CameraPosition(target: LatLng(1,1), zoom: 15),
onMapCreated: (map) {
mapReady;
},),
),
Align(
alignment:Alignment.bottomCenter,
child: IconButton(
icon: Icon(Icons.next_week), onPressed: (){}),
)
],
If I replace the IconButton widget with for example a Text widget it works well.
Could you please explain why it doesn't work, why the IconButton needs a Material ancestor?