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.

background.dart 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. alignment: Alignment.bottomCenter,
  13. children: <Widget>[
  14. Padding(
  15. padding: EdgeInsets.only(top: 0),
  16. child: Image.asset(
  17. 'assets/images/collaboration.png',
  18. width: MediaQuery.of(context).size.width / 1.5,
  19. ),
  20. ),
  21. WavyHeader()
  22. ],
  23. ),
  24. Expanded(
  25. child: Container(),
  26. ),
  27. Stack(
  28. alignment: Alignment.bottomLeft,
  29. children: <Widget>[
  30. WavyFooter(),
  31. CirclePink(),
  32. CircleYellow(),
  33. ],
  34. )
  35. ],
  36. ),
  37. );
  38. }
  39. }
  40. const List<Color> orangeGradients = [
  41. Color(0xFFFF9844),
  42. Color(0xFFFE8853),
  43. Color(0xFFFD7267),
  44. ];
  45. const List<Color> aquaGradients = [
  46. Color(0xFF5AEAF1),
  47. Color(0xFF8EF7DA),
  48. ];
  49. class WavyHeader extends StatelessWidget {
  50. @override
  51. Widget build(BuildContext context) {
  52. return ClipPath(
  53. clipper: TopWaveClipper(),
  54. child: Container(
  55. decoration: BoxDecoration(
  56. gradient: LinearGradient(
  57. colors: orangeGradients,
  58. begin: Alignment.topLeft,
  59. end: Alignment.center),
  60. ),
  61. height: MediaQuery.of(context).size.height / 2.5,
  62. ),
  63. );
  64. }
  65. }
  66. class WavyFooter extends StatelessWidget {
  67. @override
  68. Widget build(BuildContext context) {
  69. return ClipPath(
  70. clipper: FooterWaveClipper(),
  71. child: Container(
  72. decoration: BoxDecoration(
  73. gradient: LinearGradient(
  74. colors: aquaGradients,
  75. begin: Alignment.center,
  76. end: Alignment.bottomRight),
  77. ),
  78. height: MediaQuery.of(context).size.height / 3,
  79. ),
  80. );
  81. }
  82. }
  83. class CirclePink extends StatelessWidget {
  84. @override
  85. Widget build(BuildContext context) {
  86. return Transform.translate(
  87. offset: Offset(-70.0, 90.0),
  88. child: Material(
  89. color: Colors.pink,
  90. child: Padding(padding: EdgeInsets.all(120)),
  91. shape: CircleBorder(side: BorderSide(color: Colors.white, width: 15.0)),
  92. ),
  93. );
  94. }
  95. }
  96. class CircleYellow extends StatelessWidget {
  97. @override
  98. Widget build(BuildContext context) {
  99. return Transform.translate(
  100. offset: Offset(0.0, 210.0),
  101. child: Material(
  102. color: Colors.yellow,
  103. child: Padding(padding: EdgeInsets.all(140)),
  104. shape: CircleBorder(side: BorderSide(color: Colors.white, width: 15.0)),
  105. ),
  106. );
  107. }
  108. }
  109. class TopWaveClipper extends CustomClipper<Path> {
  110. @override
  111. Path getClip(Size size) {
  112. // This is where we decide what part of our image is going to be visible.
  113. var path = Path();
  114. path.lineTo(0.0, size.height);
  115. var firstControlPoint = new Offset(size.width / 7, size.height - 30);
  116. var firstEndPoint = new Offset(size.width / 6, size.height / 1.5);
  117. path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy,
  118. firstEndPoint.dx, firstEndPoint.dy);
  119. var secondControlPoint = Offset(size.width / 5, size.height / 4);
  120. var secondEndPoint = Offset(size.width / 1.5, size.height / 5);
  121. path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
  122. secondEndPoint.dx, secondEndPoint.dy);
  123. var thirdControlPoint =
  124. Offset(size.width - (size.width / 9), size.height / 6);
  125. var thirdEndPoint = Offset(size.width, 0.0);
  126. path.quadraticBezierTo(thirdControlPoint.dx, thirdControlPoint.dy,
  127. thirdEndPoint.dx, thirdEndPoint.dy);
  128. ///move from bottom right to top
  129. path.lineTo(size.width, 0.0);
  130. ///finally close the path by reaching start point from top right corner
  131. path.close();
  132. return path;
  133. }
  134. @override
  135. bool shouldReclip(CustomClipper<Path> oldClipper) => false;
  136. }
  137. class FooterWaveClipper extends CustomClipper<Path> {
  138. @override
  139. Path getClip(Size size) {
  140. var path = Path();
  141. path.moveTo(size.width, 0.0);
  142. path.lineTo(size.width, size.height);
  143. path.lineTo(0.0, size.height);
  144. path.lineTo(0.0, size.height - 60);
  145. var secondControlPoint = Offset(size.width - (size.width / 6), size.height);
  146. var secondEndPoint = Offset(size.width, 0.0);
  147. path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy,
  148. secondEndPoint.dx, secondEndPoint.dy);
  149. return path;
  150. }
  151. @override
  152. bool shouldReclip(CustomClipper<Path> oldClipper) => false;
  153. }
  154. class YellowCircleClipper extends CustomClipper<Rect> {
  155. @override
  156. Rect getClip(Size size) {
  157. throw UnimplementedError();
  158. }
  159. @override
  160. bool shouldReclip(CustomClipper<Rect> oldClipper) => false;
  161. }