I have a navigator and a map nested in a Stack, the children of the navigator have a dynamic size. Only the navigator forces himself to take all the space he can and cover the map behind him. It is therefore impossible to move the map. It's possible to make the navigator adapt to the size of the child?
class Home extends StatefulWidget {
Home({Key key}) : super(key: key);
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
StreamProvider(
create: (context) => LocationService().locationStream,
child: MapView()
),
Positioned(
width: MediaQuery.of(context).size.width * 1,
bottom: 0,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 1,
maxWidth: MediaQuery.of(context).size.width * 1
),
child: navigator(),
)
),
],
)
);
}
navigator() {
return Navigator(
initialRoute: 'anyview',
onGenerateRoute: (settings) {
Widget view;
switch (settings.name) {
case 'anyview':
view = AnyViewDraggableScrollableSheet();
break;
case 'otheranyview':
view = OtherAnyViewDraggableScrollableSheet();
break;
}
var builder = (BuildContext _) {
return view;
};
return MaterialPageRoute(builder: builder, settings: settings);
},
);
}
}
Here's a demo of the problem, the navigator takes all the available space and therefore blocks it by tapping on the red block. https://dartpad.dev/cd1c4d8f1067db0cc65ea2f62c2cbaad