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.

235 lines
9.7 KiB

2 years ago
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_svg/flutter_svg.dart';
  3. import 'package:my_flutter_puzzle/utils/extensions/context_extension.dart';
  4. import 'package:my_flutter_puzzle/utils/extensions/string_extensions.dart';
  5. class WinScreen extends StatefulWidget {
  6. final int move;
  7. final int tiles;
  8. final int level;
  9. const WinScreen({
  10. Key? key,
  11. required this.tiles,
  12. required this.move,
  13. required this.level,
  14. }) : super(key: key);
  15. @override
  16. State<WinScreen> createState() => _WinScreenState();
  17. }
  18. class _WinScreenState extends State<WinScreen> {
  19. @override
  20. Widget build(BuildContext context) {
  21. return Scaffold(
  22. backgroundColor: const Color(0xff4400CE),
  23. body: SizedBox(
  24. width: context.width,
  25. height: context.height,
  26. child: Stack(
  27. alignment: AlignmentDirectional.centerEnd,
  28. children: [
  29. Center(
  30. child: Stack(
  31. alignment: Alignment.bottomCenter,
  32. children: [
  33. Container(
  34. width: context.width * 267 / 812,
  35. height: context.height * 284 / 375,
  36. decoration: BoxDecoration(
  37. gradient: const LinearGradient(
  38. colors: [
  39. Color(0xff6236FF),
  40. Color(0xff4706CC),
  41. ],
  42. begin: Alignment.topCenter,
  43. end: Alignment.bottomCenter,
  44. ),
  45. borderRadius: BorderRadius.circular(36),
  46. ),
  47. child: Column(
  48. children: [
  49. const SizedBox(height: 31),
  50. const Text(
  51. 'Well done !',
  52. style: TextStyle(
  53. color: Colors.white,
  54. fontSize: 25,
  55. fontWeight: FontWeight.bold,
  56. ),
  57. ),
  58. const SizedBox(height: 24),
  59. Container(
  60. width: context.width * 114 / 812,
  61. height: context.width * 114 / 812,
  62. decoration: BoxDecoration(
  63. gradient: const LinearGradient(
  64. colors: [
  65. Color(0xff6236FF),
  66. Color(0xff4824CB),
  67. ],
  68. begin: Alignment.topCenter,
  69. end: Alignment.bottomCenter,
  70. ),
  71. shape: BoxShape.circle,
  72. border: Border.all(
  73. color: const Color(0xff6136FE),
  74. width: 1,
  75. ),
  76. ),
  77. child: Container(
  78. margin: EdgeInsets.all(context.width * 20 / 812),
  79. padding: EdgeInsets.all(context.width * 20 / 812),
  80. decoration: const BoxDecoration(
  81. color: Color(0xff6DD400),
  82. shape: BoxShape.circle,
  83. ),
  84. child: SvgPicture.asset(
  85. 'check'.svgPath,
  86. colorFilter: const ColorFilter.mode(
  87. Colors.white,
  88. BlendMode.srcIn,
  89. ),
  90. ),
  91. ),
  92. ),
  93. const SizedBox(height: 19),
  94. Row(
  95. mainAxisAlignment: MainAxisAlignment.center,
  96. children: [
  97. Row(
  98. children: [
  99. const Text(
  100. 'Tiles',
  101. style: TextStyle(
  102. color: Colors.white,
  103. fontSize: 13,
  104. fontWeight: FontWeight.bold,
  105. ),
  106. ),
  107. const SizedBox(width: 9),
  108. Text(
  109. '${widget.tiles}',
  110. style: const TextStyle(
  111. decoration: TextDecoration.underline,
  112. color: Colors.white,
  113. fontSize: 13,
  114. fontWeight: FontWeight.bold,
  115. ),
  116. ),
  117. ],
  118. ),
  119. const SizedBox(width: 42),
  120. Row(
  121. children: [
  122. const Text(
  123. 'Move',
  124. style: TextStyle(
  125. color: Colors.white,
  126. fontSize: 13,
  127. fontWeight: FontWeight.bold,
  128. ),
  129. ),
  130. const SizedBox(width: 9),
  131. Text(
  132. '${widget.move}',
  133. style: const TextStyle(
  134. decoration: TextDecoration.underline,
  135. color: Colors.white,
  136. fontSize: 13,
  137. fontWeight: FontWeight.bold,
  138. ),
  139. ),
  140. ],
  141. ),
  142. ],
  143. ),
  144. ],
  145. ),
  146. ),
  147. Transform.translate(
  148. offset: const Offset(0, 20),
  149. child: GestureDetector(
  150. onTap: () {
  151. },
  152. child: Container(
  153. width: context.width * 160 / 812,
  154. height: context.height * 51 / 375,
  155. padding: const EdgeInsets.all(3),
  156. decoration: BoxDecoration(
  157. color: const Color(0xff979797).withOpacity(0.12),
  158. borderRadius: BorderRadius.circular(36),
  159. ),
  160. child: Container(
  161. decoration: BoxDecoration(
  162. borderRadius: BorderRadius.circular(31),
  163. gradient: const LinearGradient(
  164. colors: [
  165. Color(0xffFFC600),
  166. Color(0xffFF5A00),
  167. ],
  168. begin: Alignment.topCenter,
  169. end: Alignment.bottomCenter,
  170. ),
  171. ),
  172. child: Row(
  173. mainAxisAlignment: MainAxisAlignment.center,
  174. children: [
  175. const SizedBox(width: 6),
  176. Container(
  177. width: context.width * 31 / 540,
  178. height: context.width * 31 / 540,
  179. padding: const EdgeInsets.all(9),
  180. margin: const EdgeInsets.symmetric(vertical: 3),
  181. decoration: BoxDecoration(
  182. border: Border.all(
  183. color: Colors.white,
  184. width: 1,
  185. ),
  186. gradient: const LinearGradient(
  187. colors: [
  188. Colors.white,
  189. Color(0xffD5D5D5),
  190. ],
  191. begin: Alignment.topCenter,
  192. end: Alignment.bottomCenter,
  193. ),
  194. shape: BoxShape.circle,
  195. ),
  196. child: SvgPicture.asset('next_level'.svgPath),
  197. ),
  198. const SizedBox(width: 8),
  199. const Text(
  200. 'Next level',
  201. style: TextStyle(
  202. color: Colors.white,
  203. fontSize: 14,
  204. fontWeight: FontWeight.bold,
  205. ),
  206. ),
  207. const SizedBox(width: 14),
  208. ],
  209. ),
  210. ),
  211. ),
  212. ),
  213. ),
  214. ],
  215. ),
  216. ),
  217. Container(
  218. margin: EdgeInsetsDirectional.only(end: context.width * 68 / 812),
  219. width: context.width * 142 / 812,
  220. height: context.height * 280 / 375,
  221. child: Image(
  222. image: AssetImage('avatar'.pngPath),
  223. ),
  224. ),
  225. ],
  226. ),
  227. ),
  228. );
  229. }
  230. }