Last active
December 6, 2018 13:43
-
-
Save shubie/e8aa14cb3c12b83dd816c213e42f7336 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
| import 'package:beautiful_list/model/lesson.dart'; | |
| import 'package:flutter/material.dart'; | |
| class DetailPage extends StatelessWidget { | |
| final Lesson lesson; | |
| DetailPage({Key key, this.lesson}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| final levelIndicator = Container( | |
| child: Container( | |
| child: LinearProgressIndicator( | |
| backgroundColor: Color.fromRGBO(209, 224, 224, 0.2), | |
| value: lesson.indicatorValue, | |
| valueColor: AlwaysStoppedAnimation(Colors.green)), | |
| ), | |
| ); | |
| final coursePrice = Container( | |
| padding: const EdgeInsets.all(7.0), | |
| decoration: new BoxDecoration( | |
| border: new Border.all(color: Colors.white), | |
| borderRadius: BorderRadius.circular(5.0)), | |
| child: new Text( | |
| // "\$20", | |
| "\$" + lesson.price.toString(), | |
| style: TextStyle(color: Colors.white), | |
| ), | |
| ); | |
| final topContentText = Column( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: <Widget>[ | |
| SizedBox(height: 120.0), | |
| Icon( | |
| Icons.directions_car, | |
| color: Colors.white, | |
| size: 40.0, | |
| ), | |
| Container( | |
| width: 90.0, | |
| child: new Divider(color: Colors.green), | |
| ), | |
| SizedBox(height: 10.0), | |
| Text( | |
| lesson.title, | |
| style: TextStyle(color: Colors.white, fontSize: 45.0), | |
| ), | |
| SizedBox(height: 30.0), | |
| Row( | |
| mainAxisAlignment: MainAxisAlignment.start, | |
| children: <Widget>[ | |
| Expanded(flex: 1, child: levelIndicator), | |
| Expanded( | |
| flex: 6, | |
| child: Padding( | |
| padding: EdgeInsets.only(left: 10.0), | |
| child: Text( | |
| lesson.level, | |
| style: TextStyle(color: Colors.white), | |
| ))), | |
| Expanded(flex: 1, child: coursePrice) | |
| ], | |
| ), | |
| ], | |
| ); | |
| final topContent = Stack( | |
| children: <Widget>[ | |
| Container( | |
| padding: EdgeInsets.only(left: 10.0), | |
| height: MediaQuery.of(context).size.height * 0.5, | |
| decoration: new BoxDecoration( | |
| image: new DecorationImage( | |
| image: new AssetImage("drive-steering-wheel.jpg"), | |
| fit: BoxFit.cover, | |
| ), | |
| )), | |
| Container( | |
| height: MediaQuery.of(context).size.height * 0.5, | |
| padding: EdgeInsets.all(40.0), | |
| width: MediaQuery.of(context).size.width, | |
| decoration: BoxDecoration(color: Color.fromRGBO(58, 66, 86, .9)), | |
| child: Center( | |
| child: topContentText, | |
| ), | |
| ), | |
| Positioned( | |
| left: 8.0, | |
| top: 60.0, | |
| child: InkWell( | |
| onTap: () { | |
| Navigator.pop(context); | |
| }, | |
| child: Icon(Icons.arrow_back, color: Colors.white), | |
| ), | |
| ) | |
| ], | |
| ); | |
| final bottomContentText = Text( | |
| lesson.content, | |
| style: TextStyle(fontSize: 18.0), | |
| ); | |
| final readButton = Container( | |
| padding: EdgeInsets.symmetric(vertical: 16.0), | |
| width: MediaQuery.of(context).size.width, | |
| child: RaisedButton( | |
| onPressed: () => {}, | |
| color: Color.fromRGBO(58, 66, 86, 1.0), | |
| child: | |
| Text("TAKE THIS LESSON", style: TextStyle(color: Colors.white)), | |
| )); | |
| final bottomContent = Container( | |
| // height: MediaQuery.of(context).size.height, | |
| width: MediaQuery.of(context).size.width, | |
| // color: Theme.of(context).primaryColor, | |
| padding: EdgeInsets.all(40.0), | |
| child: Center( | |
| child: Column( | |
| children: <Widget>[bottomContentText, readButton], | |
| ), | |
| ), | |
| ); | |
| return Scaffold( | |
| body: Column( | |
| children: <Widget>[topContent, bottomContent], | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment