Reputation: 48
I have an array of image URLs. I need to show them in a listview.builder that isn't scrolling down. I want it to show them as a stack.
Upvotes: 0
Views: 53
Reputation: 542
Stack(
alignment: Alignment.centerRight,
children: <Widget>[
Image.network(url:arr[0]),
Image.network(url:arr[1]),
],
),
);
you could lay image one by one from array
Upvotes: 0
Reputation: 5086
You can use Stack widget for this purpose. You can pass your list of images to stacks children
property.
Example:
class _StackImagesState extends State<StackImages> {
List<String> _urls = [];
@override
void initState() {
super.initState();
_urls = [
"https://toppng.com/uploads/preview/royalty-free-stock-eyelash-clipart-glitter-glitter-eyelash-transparent-background-11562955805upbu10lfl4.png",
"https://www.netclipart.com/pp/m/8-82184_banner-free-stock-apple-transparent-background-image-apple.png"
];
}
@override
Widget build(BuildContext context) {
return Stack(
children:_urls.map((String url) => Image.network(url)).toList(),
);
}
}
Upvotes: 1