Created
November 19, 2019 01:46
-
-
Save j05u3/3c48e4a62287a03a42b832c273fccf61 to your computer and use it in GitHub Desktop.
This file contains 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
@override | |
Widget build(BuildContext context) { | |
return Container( | |
decoration: BoxDecoration(color: Colors.white), | |
child: buildHomePage("my first function") | |
); | |
} | |
Widget buildHomePage(String title) { | |
final titleText = Container( | |
padding: EdgeInsets.all(20), | |
child: Text( | |
'Strawberry Pavlova', | |
style: TextStyle( | |
fontWeight: FontWeight.w800, | |
letterSpacing: 0.5, | |
fontSize: 12, | |
), | |
), | |
); | |
final subTitle = Text( | |
'Pavlova is a meringue-based dessert named after the Russian ballerina ' | |
'Anna Pavlova. Pavlova features a crisp crust and soft, light inside, ' | |
'topped with fruit and whipped cream.', | |
textAlign: TextAlign.center, | |
style: TextStyle( | |
fontFamily: 'Georgia', | |
fontSize: 10, | |
), | |
); | |
// #docregion ratings, stars | |
var stars = Row( | |
mainAxisSize: MainAxisSize.min, | |
children: [ | |
Icon(Icons.star, color: Colors.green[500], size: 7), | |
Icon(Icons.star, color: Colors.green[500], size: 7), | |
Icon(Icons.star, color: Colors.green[500], size: 7), | |
Icon(Icons.star, color: Colors.black, size: 7), | |
Icon(Icons.star, color: Colors.black, size: 7), | |
], | |
); | |
// #enddocregion stars | |
final ratings = Container( | |
padding: EdgeInsets.all(20), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: [ | |
stars, | |
Text( | |
'170 Reviews', | |
style: TextStyle( | |
color: Colors.black, | |
fontWeight: FontWeight.w800, | |
fontFamily: 'Roboto', | |
letterSpacing: 0.5, | |
fontSize: 11, | |
), | |
), | |
], | |
), | |
); | |
// #enddocregion ratings | |
// #docregion iconList | |
final descTextStyle = TextStyle( | |
color: Colors.black, | |
fontWeight: FontWeight.w800, | |
fontFamily: 'Roboto', | |
letterSpacing: 0.5, | |
fontSize: 7, | |
height: 2, | |
); | |
// DefaultTextStyle.merge() allows you to create a default text | |
// style that is inherited by its child and all subsequent children. | |
final iconList = DefaultTextStyle.merge( | |
style: descTextStyle, | |
child: Container( | |
padding: EdgeInsets.all(20), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: [ | |
Column( | |
children: [ | |
Icon(Icons.kitchen, color: Colors.green[500], size: 7), | |
Text('PREP:'), | |
Text('25 min'), | |
], | |
), | |
Column( | |
children: [ | |
Icon(Icons.timer, color: Colors.green[500], size: 7), | |
Text('COOK:'), | |
Text('1 hr'), | |
], | |
), | |
Column( | |
children: [ | |
Icon(Icons.restaurant, color: Colors.green[500], size: 7), | |
Text('FEEDS:'), | |
Text('4-6'), | |
], | |
), | |
], | |
), | |
), | |
); | |
// #enddocregion iconList | |
// #docregion leftColumn | |
final leftColumn = Container( | |
padding: EdgeInsets.fromLTRB(20, 0, 20, 20), | |
child: Column( | |
children: [ | |
titleText, | |
subTitle, | |
ratings, | |
iconList, | |
], | |
), | |
); | |
// #enddocregion leftColumn | |
final mainImage = Expanded( | |
child: Container( | |
width: double.infinity, | |
height: double.infinity, | |
child: Image.asset( | |
'assets/images/apple.jpg', | |
fit: BoxFit.cover, | |
) | |
, | |
), | |
); | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(title), | |
), | |
// #docregion body | |
body: Center( | |
child: Container( | |
margin: EdgeInsets.fromLTRB(0, 40, 0, 30), | |
height: 400, | |
child: Card( | |
child: Row( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Container( | |
width: 250, | |
child: leftColumn, | |
), | |
mainImage, | |
], | |
), | |
), | |
), | |
), | |
// #enddocregion body | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment