Skip to content

Instantly share code, notes, and snippets.

@kenreilly
Last active July 5, 2019 23:43
Show Gist options
  • Save kenreilly/04972cda4d70eb3c126932724cbb3f85 to your computer and use it in GitHub Desktop.
Save kenreilly/04972cda4d70eb3c126932724cbb3f85 to your computer and use it in GitHub Desktop.
DemoCard class for rendering content in the Flutter scroll demo project
import 'package:flutter/material.dart';
import 'items.dart';
class DemoCard extends StatelessWidget {
DemoCard(this.item);
final Item item;
static final Shadow _shadow = Shadow(offset: Offset(2.0, 2.0), color: Colors.black26);
final TextStyle _style = TextStyle(color: Colors.white70, shadows: [_shadow]);
@override
Widget build(BuildContext context) {
return Card(
elevation: 3,
shape: RoundedRectangleBorder(
side: BorderSide(width: 1, color: Colors.black26),
borderRadius: BorderRadius.circular(32)
),
color: item.color.withOpacity(.7),
child: Container(
constraints: BoxConstraints.expand(height: 256),
child: RawMaterialButton(
onPressed: () { },
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Text(item.name, style: _style.copyWith(fontSize: 64)),
Icon(item.icon, color: Colors.white70, size: 72),
]
)
],
),
)
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment