assetItemBuilder method
Implementation
Widget assetItemBuilder(String url, Map<String, double> currentAssets, int index){
// Render individual asset
Widget _displayImage(BuildContext context, String? selectedAsset){
final overlay = delegate.overlayBuilder(context, 1);
return Stack(
children: [
Positioned.fill(
child: delegate.loadingTileIndicator(context) ?? loadingTileIndicatorExample()
),
Positioned.fill(
child: Image.network(url,
fit: BoxFit.cover,
),
),
if (selectedAsset == currentAssets.keys.elementAt(index)) overlay != null ? overlay : selectedOverlay(context)
],
);
}
return StoreConnector<GiphyState, String?>(
converter: (store) => store.state.selectedAsset,
builder: (context, selectedAsset) {
return FlatButton(
padding: EdgeInsets.zero,
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: 300,
minHeight: 125,
),
child: AnimationConfiguration.staggeredGrid(
columnCount: (index / 2).floor(),
position: index,
duration: const Duration(milliseconds: 375),
child: ScaleAnimation(
child: FadeInAnimation(
child: _displayImage(context, selectedAsset)
),
),
),
),
onPressed: (){
if(selectedAsset == currentAssets.keys.elementAt(index))
provider.dispatch(unSelectGif());
else provider.dispatch(selectAsset(currentAssets.keys.elementAt(index)));
giphyPickerController!.update();
},
);
}
);
}