当我列出从api到carousel_slider的多个图像时遇到问题。 它总是崩溃并且没有显示错误。
我已将其与旧应用进行比较,它可以正常运行,但另一个应用总是崩溃。
return ChangeNotifierProvider(
create: (context) => HomeProvider(),
child: Consumer<HomeProvider>(builder: (bContext, homeProderAction, _) {
return RefreshIndicator(
key: refreshKey,
onRefresh: () async {
refreshKey.currentState?.show(atTop: false);
await Future.delayed(Duration(seconds: 1));
homeProderAction.setHomeData(homeData: fetchHomeData());
return null;
},
child: FutureBuilder<HomeModel>(
future: _homeData,
builder: (context, snapshot) {
print('hello world');
// if (_source.keys.toList()[0] == ConnectivityResult.wifi ||
// _source.keys.toList()[0] == ConnectivityResult.mobile) {
if (snapshot.hasData &&
snapshot.connectionState == ConnectionState.done) {
// return Container(
// child: ListView.builder(
// itemCount: 2 + snapshot.data.categories.length,
// shrinkWrap: true,
// addAutomaticKeepAlives: true,
// itemBuilder: (context, ind) {
// //Developer sum array of banner and course together
// //That's why list index 0 for homepage banner
// //And other for other ...
// if (ind == 0) {
return Container(
width: MediaQuery.of(context).size.width,
child: CarouselSlider.builder(
enableInfiniteScroll: true,
viewportFraction: 1.0,
height: 100,
itemCount: snapshot.data.courses.length,
itemBuilder: (context, ind) {
return Container(
width: 100,
height: 100,
color: Colors.pink,