I would like to build a screen with a single scroll of a graph and a ListView together
Currently with this code I rightly only get the ListView scroll (see fig)
Widget loadStat() {
pagesStatPageWidget = _buildPagesStat();
pagesStatGraphWidget = _graphWidget();
return new Column(
children: <Widget>[
pagesStatGraphWidget,
pagesStatPageWidget,
],
);
}
Widget _graphWidget() {
return Container(
width: 200.0,
height: 200.0,
child: new GaugeChart(
_createSampleData(),
animate: true,
),
);
}
Widget _buildPagesStat() {
return Expanded(
child: ListView.builder(
padding: const EdgeInsets.all(0.0),
itemBuilder: (context, i) {
return _buildLogStat(pagesList[i], titolo);
},
itemCount: pagesList.length,
),
);
}
I read that the solution should be inserting chart and ListView under a column but I made several attempts with Column, Flexible, List without any success.
Can someone help me?
Special thanks
Solution 1: Mathiew Abbas
I think what you're looking for is a CustomScrollView
try this out:
return CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(child: your_graph_widget), //Your graph widget
SliverList(), //Reformat your list into a sliver list.
]
)