Created
August 7, 2020 17:20
-
-
Save naywin-programmer/99e89c73214962a09dd942c6f2374b96 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
// 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, | |
) | |
); | |
} | |
) | |
); | |
} | |
} |
Author
naywin-programmer
commented
Aug 7, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment