I am getting images using gridview and using futurebuilder. But I need to add one static photo.I replaced the photos from futurebuilder fine but also I want to add one photo which is static from outside of the futurebuilder. This is how I want my gridview looks like:
I want to add this picture to gridview:
This is my code:
...
future: future,
builder: (ctx, snapshot) => snapshot.connectionState ==
ConnectionState.waiting
? Center(
child: CircularProgressIndicator(),
)
: Column(
children: [
Flexible(
flex: 5,
child: Container(
padding: EdgeInsets.only(
top: 40,
bottom: 1,
left: 40,
right: 40),
child: Consumer<Images>(
builder: (ctx, titles, ch) =>
GridView.builder(
physics: ScrollPhysics(),
itemCount: titles.items.length,
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: getSize(
_currentSliderValue),
mainAxisSpacing: 50,
childAspectRatio: 115 / 162.05,
crossAxisSpacing: 5,
),
itemBuilder: (ctx, index) {
saveallimages(titles.items);
return GestureDetector(
onTap: () => add(titles
.items[index].image),
//()=>add(titles.items[index].image),
child: selected.contains(
titles.items[index]
.image.path
.toString())
? Container(
child: selectedimage(
titles
.items[
index]
.image))
: Container(
child: nonselected(
titles
.items[
index]
.image)));
}),
...
Increase itemCount
by 1. In itemBuilder
check if index == titles.items.length
, and display your static item if so.