Last active
January 24, 2020 15:06
-
-
Save jwiese-ms/96bccf0e08b7a413c098f810e9d9bf5c to your computer and use it in GitHub Desktop.
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
SliverGrid( | |
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | |
// this needs to work with the control, should be able to get the size of the display we are on, not the whole device. | |
crossAxisCount: ((MediaQuery.of(context).size.width > 540 ? 540 : MediaQuery.of(context).size.width) / 200).round(), | |
), | |
delegate: SliverChildBuilderDelegate((BuildContext context, int index) { | |
return CastTile(castMember: currentCast[index]); | |
}, | |
childCount: currentCast == null ? 0 : currentCast.length, | |
), | |
), | |
// in CastTile() here is how I handle the lazy loading of the cast images | |
Container( | |
height: 100, | |
width: 100, | |
decoration: BoxDecoration( | |
borderRadius: BorderRadius.circular(10.0), | |
image: DecorationImage( | |
image: usePlaceholder ? AssetImage('assets/castplaceholder.png') : NetworkImage('https://image.tmdb.org/t/p/w500/' + castMember['profile_path']), | |
fit: BoxFit.cover, | |
), | |
boxShadow: [ | |
BoxShadow( | |
color: Colors.black, | |
blurRadius: 20.0, | |
offset: Offset(0.0, 10.0), | |
) | |
], | |
), | |
), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment