Advertisement
Guest User

TercerRetoPlatzi

a guest
Jan 9th, 2019
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class TercerReto extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. return Scaffold(
  7. appBar: AppBar(
  8. leading: Icon(
  9. Icons.dehaze
  10. ),
  11. centerTitle: true,
  12. title: Text(
  13. 'Rock clásico',
  14. style: TextStyle(
  15. fontFamily: "Lato",
  16. fontWeight: FontWeight.w900
  17. ),
  18. ),
  19. elevation: 0.0,
  20. backgroundColor: Color(0xFFD299C2),
  21. ),
  22. body: Stack(
  23. children: <Widget>[
  24. CustomBackground(),
  25. BandCardList()
  26. ],
  27. ),
  28. );
  29. }
  30. }
  31.  
  32. class CustomBackground extends StatelessWidget {
  33. @override
  34. Widget build(BuildContext context) {
  35. return Container(
  36. height: MediaQuery.of(context).size.height,
  37. width: MediaQuery.of(context).size.width,
  38. decoration: BoxDecoration(
  39. gradient: LinearGradient(
  40. colors: [
  41. Color(0xFFD299C2),
  42. Color(0xFFfef9d7)
  43. ],
  44. begin: Alignment(-0.2, -1.0),
  45. end: Alignment(0.0, 1.0),
  46. stops: [0.3,1.0]
  47. )
  48. ),
  49. );
  50. }
  51. }
  52.  
  53. class BandCard extends StatelessWidget {
  54.  
  55. String image;
  56. String bandName;
  57. String bandYears;
  58. bool favorite;
  59. BandCard(this.image, this.bandName, this.bandYears, this.favorite);
  60.  
  61. @override
  62. Widget build(BuildContext context) {
  63. Widget favoriteState;
  64. if(favorite){
  65. favoriteState = Icon(
  66. Icons.favorite,
  67. color: Colors.pinkAccent,
  68. );
  69. }
  70. else{
  71. favoriteState = Icon(
  72. Icons.favorite_border,
  73. color: Colors.pinkAccent,
  74. );
  75. }
  76. return Card(
  77. color: Colors.transparent,
  78. elevation: 0.6,
  79. margin: EdgeInsets.only(
  80. top: 20.0,
  81. left: 20.0,
  82. right: 20.0
  83. ),
  84. child: Column(
  85. mainAxisSize: MainAxisSize.min,
  86. children: <Widget>[
  87. ListTile(
  88. leading: CircleAvatar(
  89. backgroundImage: NetworkImage(image),
  90. ),
  91. title: Text(
  92. bandName,
  93. style: TextStyle(
  94. fontFamily: "Lato",
  95. fontWeight: FontWeight.w600,
  96. fontSize: 20.0
  97. ),
  98. ),
  99. subtitle: Text(
  100. bandYears,
  101. style: TextStyle(
  102. fontFamily: "Lato",
  103. fontWeight: FontWeight.w400,
  104. fontSize: 17.0
  105. ),
  106. ),
  107. trailing: favoriteState,
  108. )
  109. ],
  110. ),
  111. );
  112. }
  113. }
  114.  
  115. class BandCardList extends StatelessWidget {
  116. String queenImage = 'http://www.mexmads.com/wp-content/uploads/2018/11/z10358342QQueen.jpg';
  117. String pinkFImage = 'https://universal881.com/wp-content/uploads/2016/10/Blog_20161003_Universal_Musica_8DatosCuriososDeRogerWaters2.jpg';
  118. String gunsImage = 'https://pbs.twimg.com/profile_images/885491686327169024/ufh03Wmg.jpg';
  119. String aerosmithFImage = 'https://www.musicrecordshop.com/media/catalog/product/cache/1/image/650x/040ec09b1e35df139433887a97daa66f/a/e/aerosmith.jpg';
  120. String ledZImage = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRsI61Y-VSVwVC3GM4xanp71VX59HLbFkSDzK1JbyX8zhGfja7hsw';
  121. String smithsImage = 'https://is4-ssl.mzstatic.com/image/thumb/Music4/v4/fd/e2/24/fde224a7-3ce9-3d93-8a12-eaab672c78a1/825646937097.jpg/600x600bf.png';
  122.  
  123. @override
  124. Widget build(BuildContext context) {
  125. return ListView(
  126. children: <Widget>[
  127. BandCard(queenImage, 'Queen', '1970-',true),
  128. BandCard(pinkFImage, 'Pink Floyd', '1965-1995 ', true),
  129. BandCard(gunsImage, 'Guns N Roses', '1985-', false),
  130. BandCard(aerosmithFImage, 'Aerosmith', '1970-', false),
  131. BandCard(ledZImage, 'Led Zepellin', '1968-1980', false),
  132. BandCard(smithsImage, 'The Smiths', '1982-1987', true),
  133. BandCard(queenImage, 'Queen', '1970-',true),
  134. BandCard(queenImage, 'Queen', '1970-',true),
  135. BandCard(queenImage, 'Queen', '1970-',true),
  136.  
  137. ],
  138. );
  139. }
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement