Created
December 14, 2019 15:28
-
-
Save rrifafauzikomara/3a109973bc9b150c7d26604811a0cd0a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import 'package:cached_network_image/cached_network_image.dart'; | |
import 'package:flutter/material.dart'; | |
class Poster extends StatelessWidget { | |
static const POSTER_RATIO = 0.7; | |
Poster( | |
this.posterUrl, { | |
this.height = 100.0, | |
}); | |
final String posterUrl; | |
final double height; | |
@override | |
Widget build(BuildContext context) { | |
var width = POSTER_RATIO * height; | |
return Material( | |
borderRadius: BorderRadius.circular(4.0), | |
elevation: 2.0, | |
child: CachedNetworkImage( | |
imageUrl: posterUrl, | |
fit: BoxFit.cover, | |
width: width, | |
height: height, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment