Created
December 18, 2019 10:50
-
-
Save greycode/71976d11d633ed817f7f476e4209c133 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:flutter/material.dart'; | |
import 'dart:math' as math; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
//theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
backgroundColor: Color(0xfff2f2f2), | |
body: MyWidget(), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Stack(children: [ | |
ClipPath( | |
clipper: HomeClipper(), | |
child: Container( | |
decoration: BoxDecoration( | |
gradient: LinearGradient(colors: [ | |
Color(0xff1e75c9), | |
Color(0xff388bed), | |
])), | |
height: 300.0, | |
), | |
), | |
Padding( | |
padding: EdgeInsets.only(left: 20, right: 20, top: 30), | |
child: Column( | |
children: <Widget>[ | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: <Widget>[ | |
Icon( | |
Icons.keyboard_arrow_left, | |
color: Colors.white, | |
size: 26, | |
), | |
Text("Top Selection", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 20, | |
fontWeight: FontWeight.bold)), | |
Transform( | |
transform: Matrix4.rotationY(math.pi), | |
child: Icon( | |
Icons.reply, | |
color: Colors.white, | |
size: 26, | |
), | |
), | |
], | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 25), | |
child: SizedBox( | |
height: 30, | |
child: ListView( | |
scrollDirection: Axis.horizontal, | |
children: <Widget>[ | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.center, | |
mainAxisAlignment: MainAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
"Picked For You", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 18, | |
fontWeight: FontWeight.w900), | |
), | |
Padding( | |
padding: EdgeInsets.only(top: 2), | |
child: Container( | |
decoration: BoxDecoration( | |
shape: BoxShape.rectangle, | |
borderRadius: BorderRadius.circular(5), | |
color: Color(0xfffec52b), | |
), | |
width: 30, | |
height: 6, | |
), | |
), | |
], | |
), | |
SizedBox( | |
width: 35, | |
), | |
Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
"Consumer Electronics", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 18, | |
fontWeight: FontWeight.w100), | |
), | |
], | |
), | |
SizedBox( | |
width: 35, | |
), | |
Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
children: <Widget>[ | |
Text( | |
"Health Care", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 18, | |
fontWeight: FontWeight.w100), | |
), | |
], | |
), | |
], | |
), | |
), | |
), | |
Padding( | |
padding: EdgeInsets.symmetric(vertical: 35), | |
child: Align( | |
alignment: Alignment.centerLeft, | |
child: Text( | |
"Only the best quality & service", | |
style: TextStyle( | |
color: Colors.white, | |
fontSize: 24, | |
), | |
), | |
)), | |
ItemList(), | |
], | |
), | |
), | |
]); | |
} | |
} | |
class ItemList extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return SizedBox( | |
height: MediaQuery.of(context).size.height - 210, | |
child: ListView( | |
children: <Widget>[ | |
Item1(), | |
Item1(), | |
Item1(), | |
Item1(), | |
Item1(), | |
], | |
), | |
); | |
} | |
} | |
class Item1 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Padding( | |
padding: EdgeInsets.only(bottom: 10), | |
child: Container( | |
padding: EdgeInsets.all(15), | |
decoration: BoxDecoration( | |
shape: BoxShape.rectangle, | |
borderRadius: BorderRadius.all(Radius.circular(10)), | |
color: Colors.white, | |
), | |
height: 200, | |
child: Row( | |
mainAxisSize: MainAxisSize.max, | |
children: <Widget>[ | |
Image.network( | |
"https://s2.ax1x.com/2019/12/18/Q7gwjA.jpg", | |
width: 150, | |
height: double.infinity, | |
fit: BoxFit.fitHeight, | |
), | |
SizedBox( | |
width: 10, | |
), | |
Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
mainAxisSize: MainAxisSize.max, | |
children: <Widget>[ | |
Text( | |
"ROCKBROS Cycling Glasses", | |
style: TextStyle( | |
color: Color(0xff999999), | |
fontSize: 17, | |
fontWeight: FontWeight.w100, | |
), | |
), | |
SizedBox( | |
height: 2, | |
), | |
Text( | |
"Frame Polarized Sunglasses", | |
style: TextStyle( | |
color: Color(0xff999999), | |
fontSize: 15, | |
fontWeight: FontWeight.w100, | |
), | |
), | |
SizedBox( | |
height: 15, | |
), | |
ItemTag(), | |
SizedBox( | |
height: 10, | |
), | |
Row( | |
children: <Widget>[ | |
Text( | |
"\$", | |
style: TextStyle( | |
color: Color(0xfffe4c24), | |
fontSize: 16, | |
fontWeight: FontWeight.bold, | |
decoration: TextDecoration.underline, | |
decorationStyle: TextDecorationStyle.solid, | |
), | |
), | |
Text( | |
"12.00", | |
style: TextStyle( | |
color: Colors.black, | |
fontSize: 16, | |
fontWeight: FontWeight.w100, | |
), | |
), | |
], | |
), | |
SizedBox( | |
height: 2, | |
), | |
Row( | |
children: <Widget>[ | |
Text( | |
"\$", | |
style: TextStyle( | |
color: Color(0xff999999), | |
fontSize: 13, | |
fontWeight: FontWeight.w100, | |
decoration: TextDecoration.combine([ | |
TextDecoration.underline, | |
TextDecoration.lineThrough, | |
]), | |
decorationStyle: TextDecorationStyle.solid, | |
), | |
), | |
Text( | |
"30.00", | |
style: TextStyle( | |
color: Color(0xff999999), | |
fontSize: 13, | |
fontWeight: FontWeight.w100, | |
decoration: TextDecoration.lineThrough, | |
), | |
), | |
], | |
), | |
SizedBox( | |
height: 10, | |
), | |
Row( | |
children: <Widget>[ | |
SizedBox( | |
width: 120, | |
), | |
Container( | |
padding: | |
EdgeInsets.symmetric(horizontal: 8, vertical: 5), | |
decoration: BoxDecoration( | |
shape: BoxShape.rectangle, | |
borderRadius: BorderRadius.all(Radius.circular(20)), | |
border: Border.all(color: Colors.blue), | |
), | |
child: Text( | |
"SHOP NOW", | |
style: TextStyle( | |
color: Colors.blue, | |
fontSize: 14, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
), | |
], | |
), | |
], | |
), | |
], | |
), | |
)); | |
} | |
} | |
class ItemTag extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
padding: EdgeInsets.symmetric(vertical: 3, horizontal: 6), | |
decoration: BoxDecoration( | |
color: Color(0xffffd000), | |
shape: BoxShape.rectangle, | |
borderRadius: BorderRadius.all(Radius.circular(5)), | |
), | |
height: 24, | |
child: Row( | |
children: <Widget>[ | |
Text( | |
"PICK OF THE DAY", | |
style: TextStyle( | |
color: Color(0xfffe4c24), | |
fontSize: 12, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
SizedBox( | |
width: 5, | |
), | |
Container( | |
width: 2, | |
height: 12, | |
color: Colors.white, | |
), | |
SizedBox( | |
width: 5, | |
), | |
Text( | |
"-62%", | |
style: TextStyle( | |
color: Color(0xfffe4c24), | |
fontSize: 12, | |
fontWeight: FontWeight.w100, | |
), | |
), | |
], | |
), | |
); | |
} | |
} | |
class HomeClipper extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
final path = Path(); | |
path.lineTo(0, size.height - 50); | |
path.quadraticBezierTo( | |
size.width / 2, size.height, size.width, size.height - 50); | |
path.lineTo(size.width, 0); | |
path.close(); | |
return path; | |
} | |
@override | |
bool shouldReclip(HomeClipper oldClipper) => false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment