Skip to content

Instantly share code, notes, and snippets.

@naywin-programmer
Created August 7, 2020 17:20
Show Gist options
  • Save naywin-programmer/99e89c73214962a09dd942c6f2374b96 to your computer and use it in GitHub Desktop.
Save naywin-programmer/99e89c73214962a09dd942c6f2374b96 to your computer and use it in GitHub Desktop.
// Flutter code sample for Card
// This sample shows creation of a [Card] widget that shows album information
// and two actions.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(title: const Text(_title)),
body: MyStatelessWidget(),
),
);
}
}
/// This is the stateless widget that the main application instantiates.
class MyStatelessWidget extends StatelessWidget {
MyStatelessWidget({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: 200,
child: ListView.builder(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.all(16),
itemCount: 3,
itemBuilder: (BuildContext context, int index) {
return Container(
width: 200,
child: Stack(
children: <Widget>[
Card(
child: Container(
padding: EdgeInsets.all(20.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const ListTile(
title: Text('The Enchanted Nightingale'),
subtitle: Text('Music by Julie Gable. Lyrics by Sidney Stein. haha that is really so cool...'),
),
],
),
),
),
Positioned(
bottom: -20,
child: RaisedButton(
onPressed: () {},
child: const Text(
'Get Coupon',
style: TextStyle(fontSize: 14)
),
),
),
],
alignment: AlignmentDirectional.bottomCenter,
overflow: Overflow.visible,
)
);
}
)
);
}
}
@naywin-programmer
Copy link
Author

Screen Shot 2020-08-07 at 23 47 59
Screen Shot 2020-08-07 at 23 48 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment