Created
April 13, 2020 13:58
-
-
Save vijayinyoutube/c22084f7e7a9a8d18b743cd0cefbc35e 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
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: MyPage(), | |
); | |
} | |
} | |
class MyPage extends StatefulWidget { | |
@override | |
_MyPageState createState() => _MyPageState(); | |
} | |
class _MyPageState extends State<MyPage> { | |
@override | |
Widget build(BuildContext context) { | |
var deviceWidth = MediaQuery.of(context).size.width; | |
return Scaffold( | |
body: SingleChildScrollView( | |
child: Column( | |
// mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
ClipPath( | |
clipper: MyClipper(), | |
child: Container( | |
padding: EdgeInsets.symmetric(horizontal: 10), | |
height: 300, | |
width: double.infinity, | |
decoration: BoxDecoration( | |
gradient: LinearGradient( | |
begin: Alignment.topRight, | |
end: Alignment.bottomLeft, | |
colors: [ | |
Color(0xFF3383CD), | |
Color(0xFF11249F), | |
], | |
), | |
), | |
)), | |
], | |
), | |
), | |
); | |
} | |
} | |
class MyClipper extends CustomClipper<Path> { | |
@override | |
Path getClip(Size size) { | |
var path = Path(); | |
path.lineTo(0, size.height - 80); | |
path.quadraticBezierTo( | |
size.width / 2, size.height, size.width, size.height - 80); | |
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