I have two problem,I'm using page view builder to build my days,
child: PageView.builder(
physics: new AlwaysScrollableScrollPhysics(),
itemCount: allDays.length,
controller: _pageController,
itemBuilder: ( context, int index) {
return _listDay(index);
},
),
every day contain list of times from api,
void initState() {
_futureTime = getDateDayAPI1.getTimeApi(doctorInfoName, widget.dayName);
super.initState();
_futureTime.then((value){
setState(() {
_snapshotTimes.addAll(value);
});
});
_future.then((data) {
setState(() {
_snapshot.addAll(data);
});
},);
}
Widget build(BuildContext context) {
return FutureBuilder(
future: _futureTime,
builder: (context, AsyncSnapshot snapshot){
if (_futureTime == null){
return Container(
child: Center(child: loadingRing(),),
);
}
else {
return SizedBox(
width: 150,
height: 180,
child: ListView.builder(
itemCount: 6,
itemBuilder: (context, index) {
return index == 0 ? Container() : _listItem(index-1);
},
),
);
}
}
);
}
the first problem is the widget rebuild it self on scrolling, the seconde that it show the error in this picture RangeError (index): Invalid value: Only valid value is 0: 1