Created
December 9, 2022 16:26
-
-
Save ibrajix/5d9d3bf7a43213ca21a1abf02f24e442 to your computer and use it in GitHub Desktop.
top_picks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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