No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

backgroundHistory.dart 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import 'package:flutter/material.dart';
  2. class Background extends StatelessWidget {
  3. const Background({Key? key}) : super(key: key);
  4. @override
  5. Widget build(BuildContext context) {
  6. return Scaffold(
  7. resizeToAvoidBottomInset: false,
  8. backgroundColor: Colors.white,
  9. body: Column(
  10. children: <Widget>[
  11. new Stack(
  12. children: <Widget>[
  13. WavyHeader()
  14. ],
  15. ),
  16. ],
  17. ),
  18. );
  19. }
  20. }
  21. const List<Color> orangeGradients = [
  22. Color(0xFFD21404),
  23. Color(0xFFFD7267)
  24. ];
  25. const List<Color> aquaGradients = [
  26. Color(0xFF8EF7DA),
  27. Color(0xFF5AEAF1),
  28. Colors.blueAccent,
  29. ];
  30. class WavyHeader extends StatelessWidget {
  31. @override
  32. Widget build(BuildContext context) {
  33. return ClipPath(
  34. clipper: TopWaveClipper(),
  35. child: Container(
  36. decoration: BoxDecoration(
  37. gradient: LinearGradient(
  38. colors: orangeGradients,
  39. begin: Alignment.topLeft,
  40. end: Alignment.center),
  41. ),
  42. height: MediaQuery.of(context).size.height / 2.5,
  43. ),
  44. );
  45. }
  46. }
  47. class TopWaveClipper extends CustomClipper<Path> {
  48. @override
  49. Path getClip(Size size) {
  50. // This is where we decide what part of our image is going to be visible.
  51. var path = Path();
  52. path.lineTo(0.0, 0.0);
  53. var firstControlPoint = new Offset(0, size.height - 30);
  54. var firstEndPoint = new Offset(0, size.height / 2);
  55. path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
  56. firstEndPoint.dx, firstEndPoint.dy);
  57. var secondControlPoint = Offset(size.width / 5, size.height / 4);
  58. var secondEndPoint = Offset(size.width / 1.5, size.height / 5);
  59. path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
  60. secondEndPoint.dx, secondEndPoint.dy);
  61. var thirdControlPoint =
  62. Offset(size.width - (size.width / 9), size.height / 6);
  63. var thirdEndPoint = Offset(size.width, 0.0);
  64. path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
  65. thirdEndPoint.dx, thirdEndPoint.dy);
  66. ///move from bottom right to top
  67. path.lineTo(size.width, 0.0);
  68. ///finally close the path by reaching start point from top right corner
  69. path.close();
  70. return path;
  71. }
  72. @override
  73. bool shouldReclip(CustomClipper<Path> oldClipper) => false;
  74. }