My ListView is laggy only when I scroll up. My list view is a children of a FurureBuilder. I tried addAutomaticKeepAlives: true because my data is static, but it seems to make no changes.
Please help me When I scroll up the scoll jumps suddenly up. A video showing it: https://streamable.com/1cjg3
class NavigatePageState extends State<NavigatePage> with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
child: Center(
child: FutureBuilder(
future: getPrincipalList(),
builder: (context, snapshot) {
if (snapshot.data == null) {
return Column(
children: <Widget>[
Center(
child: Text('Loading...') ,
)
,
Container(
margin: EdgeInsets.only(top:100),
child: PlatformCircularProgressIndicator(
android: (_) => MaterialProgressIndicatorData(),
ios: (_) => CupertinoProgressIndicatorData(),
),
)
],
);
} else {
return ListView.builder(
addAutomaticKeepAlives: true,
addRepaintBoundaries: false,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemCount: snapshot.data.result.length,
itemBuilder: (context, rowInt) {
return Column(
children: <Widget>[
Container(
child: sliderOfSongs(
topName: snapshot.data.result[rowInt].infoDetail.name,
topDescription:
snapshot.data.result[rowInt].infoDetail.description,
collectionName: snapshot
.data.result[rowInt].infoDetail.collectionName,
topIndex: rowInt,
)),
Divider(
color: Colors.blueGrey,
indent: 120,
endIndent: 120,
)
],
);
},
);
}
},
),
),
navigationBar: CupertinoNavigationBar(
middle: Text('Navigate'),
),
);
}
@override
bool get wantKeepAlive => true;
}