如何在搜索结果后向轮播添加更多图片?

问题描述

我想知道如何将更多图片添加到我的轮播中。我假设我需要制作另一个 ImageList 但如何制作特定于我的一个平台的列表?以便在 IOS 的详细信息页面不显示 Google 的图像。该代码目前适用于一张图像,但我想再添加一些。我该怎么做?

class MyPlatforms {
  String name;
  String image;

  MyPlatforms(
      {this.image,this.name,});
}

//A MyPlatforms list created using that modal
final List<MyPlatforms> myPlatformsList = [
  MyPlatforms(
      image: "assets/testimage01.jpg",name: "Google"),MyPlatforms(image: "assets/images/ios.png",name: "IOS"),];

    return ListView.builder(
      itemBuilder: (context,index) => ListTile(
        onTap: () {
          close(context,suggestionsList[index]);
          Navigator.push(
              context,MaterialPageRoute(
                  builder: (context) => DetailScreen(
                        item: myPlatformsList[
                            index],//pass the index of the MyPlatforms list
                      )));
        },title: Text(suggestionsList[index]),),itemCount: suggestionsList.length,);
  }
}

class DetailScreen extends StatelessWidget {
  final MyPlatforms
  item; //Get the item,as a object of MyPlatforms class so the we can acess its all properties like image and name;

  DetailScreen({this.item});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("${item.name}"),body: SingleChildScrollView(
        child: Column(
          children: <Widget>[
            new SizedBox(
              height: 20,SizedBox(
              height: 400,width: 300,child: Carousel(
                BoxFit: BoxFit.cover,autoplay: false,showIndicator: false,images: [Image.asset("${item.image}")],],);
  }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)