Skip to content

Instantly share code, notes, and snippets.

@ibrajix
Created December 9, 2022 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibrajix/5d9d3bf7a43213ca21a1abf02f24e442 to your computer and use it in GitHub Desktop.
Save ibrajix/5d9d3bf7a43213ca21a1abf02f24e442 to your computer and use it in GitHub Desktop.
top_picks
_topPickItems(){
return BlocBuilder<NftBloc, ApiState>(
builder: (context, state) {
return SizedBox(
width: MediaQuery.of(context).size.width,
height: 180,
child: ListView(
scrollDirection: Axis.horizontal,
children: state.topNft.map<Widget>((data){
return DisplayTopPick(data: data);
}).toList()
),
);
},
);
}
class DisplayTopPick extends StatelessWidget {
const DisplayTopPick({this.data, super.key});
final TopNft? data;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.only(top: 20, right: 15),
child: GestureDetector(
onTap: () {
ScaffoldMessenger.of(context).showSnackBar( SnackBar(
content: Text("${Strings.topItemClicked} ${data?.id}"),
duration: const Duration(milliseconds: 200),
));
},
child: Column(
children: [
Container(
width: 140,
height: 140,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(data?.image ?? ""),
),
borderRadius: const BorderRadius.all(Radius.circular(20))
),
)
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment