如何解决如何在搜索结果后向轮播添加更多图片?
我想知道如何将更多图片添加到我的轮播中。我假设我需要制作另一个 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 举报,一经查实,本站将立刻删除。