Created
December 29, 2019 14:07
-
-
Save adityajoshi12/34a996e92c79d364fa43b8b3680bb6a9 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'; | |
final Color darkBlue = Color(0xffffffff); | |
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( | |
body: Stack(children: [ | |
Padding( | |
padding: EdgeInsets.all(20), | |
child: ClipPath( | |
clipper: MyClipper(), | |
child: Container( | |
decoration: BoxDecoration( | |
boxShadow: [ | |
BoxShadow( | |
color: Colors.black.withOpacity(.5), | |
spreadRadius: 13, | |
blurRadius: 13.0, | |
offset: Offset(6.0, 7.0), | |
), | |
], | |
gradient: LinearGradient( | |
begin: Alignment.topRight, | |
end: Alignment.bottomLeft, | |
//stops: [0.1, 0.5, 0.7, 0.9], | |
colors: [ | |
Color(0xFFF9D976), | |
Color(0xFFF39F86), | |
], | |
), | |
color: Colors.red)), | |
)), | |
Positioned( | |
top: 320, | |
child: Padding( | |
padding:EdgeInsets.all(28), | |
child: Image.network( | |
"https://upload.wikimedia.org/wikipedia/en/thumb/e/e0/Iron_Man_bleeding_edge.jpg/250px-Iron_Man_bleeding_edge.jpg"))) | |
]))); | |
} | |
} | |
class MyClipper extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
var path = new Path(); | |
path.lineTo(0.0, size.height * 0.75); | |
// var firstEndPoint = new Offset(size.width / 2, size.height - 40); | |
// var firstControlPoint = new Offset(size.width / 4, size.height); | |
// path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, | |
// firstEndPoint.dx, firstEndPoint.dy); | |
// var secondControlPoint = | |
// Offset(size.width - (size.width / 3.25), size.height - 65); | |
// var secondEndPoint = Offset(size.width, size.height - 40); | |
// path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, | |
// secondEndPoint.dx, secondEndPoint.dy); | |
// path.lineTo(size.width, size.height - 40); | |
// path.lineTo(size.width, 0.0); | |
var firstControlPoint = Offset(size.width / 2, size.height); | |
var firstEndPoint = new Offset(size.width, size.height * 0.75); | |
path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, | |
firstEndPoint.dx, firstEndPoint.dy); | |
path.lineTo(size.width, 0); | |
path.close(); | |
return path; | |
} | |
@override | |
bool shouldReclip(CustomClipper<Path> oldClipper) { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment