Skip to content

Instantly share code, notes, and snippets.

@MarcinusX
Created April 25, 2019 09:48
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 MarcinusX/7c0dbabc9d6366ca8ec2069b969c951a to your computer and use it in GitHub Desktop.
Save MarcinusX/7c0dbabc9d6366ca8ec2069b969c951a to your computer and use it in GitHub Desktop.
class SlidingCard extends StatelessWidget {
final String name; //<-- title of the event
final String date; //<-- date of the event
final String assetName; //<-- name of the image to be displayed
const SlidingCard({
Key key,
@required this.name,
@required this.date,
@required this.assetName,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.only(left: 8, right: 8, bottom: 24),
elevation: 8,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(32)), //<--custom shape
child: Column(
children: <Widget>[
ClipRRect( //<--clipping image
borderRadius: BorderRadius.vertical(top: Radius.circular(32)),
child: Image.asset( //<-- main image
'assets/$assetName',
height: MediaQuery.of(context).size.height * 0.3,
fit: BoxFit.none,
),
),
SizedBox(height: 8),
Expanded(
child: Container(), //<-- will be replaced soon :)
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment