I want to put a MapWidget into a FlexibleSpaceBar
(inside a SliverAppBar
inside a NestedScrollView
) to show it in a Collapsable Toolbar. My widget tree looks like this:
Scaffold
|
|- NestedScrollView
|
|- SliverAppBar
| |
| |- FlexibleSpaceBar
| |
| |- Map
|
|- ListView
The problem is that the NestedScrollView
consumes all the Gesture events and I cannot use pinch-to-zoom any more on the Map
. What's the best way to solve this?
Here's some code:
class ListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<int> list = List<int>.generate(10, (i) => i + 1);
return NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) {
return [
SliverAppBar(
expandedHeight: 250.0,
floating: true,
pinned: true,
snap: false,
flexibleSpace: FlexibleSpaceBar(
title: Text('Second Screen'),
background: MapWidget(),
)),
];
},
body: ListView.builder(
itemCount: list.length,
itemBuilder: (context, index) {
int item = list[index];
return Text('item $item');
},
),
);
}
}