暫無描述
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

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