noti_enter.dart 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import 'package:fast/constants.dart';
  2. import 'package:fast/model/model.dart';
  3. import 'package:fast/utils/api.dart';
  4. import 'package:fast/utils/http_utils.dart';
  5. import 'package:fast/utils/size_fit.dart';
  6. import 'package:fast/view/component/challenge_result.dart';
  7. import 'package:fast/view/component/share.dart';
  8. import 'package:flutter/material.dart';
  9. class NotifiEnter extends StatefulWidget {
  10. String fastId;
  11. NotifiEnter({Key? key, required this.fastId}) : super(key: key);
  12. @override
  13. State<NotifiEnter> createState() => _NotifiEnterState();
  14. }
  15. class _NotifiEnterState extends State<NotifiEnter> {
  16. FastResultBean? resultBean;
  17. @override
  18. void initState() {
  19. super.initState();
  20. getDetail();
  21. }
  22. share() {
  23. showDialog(
  24. context: context,
  25. barrierDismissible: false,
  26. barrierColor: const Color(0xF2000D1F),
  27. builder: (BuildContext context) {
  28. return Share(
  29. type: 'challenge',
  30. resultBean: resultBean,
  31. );
  32. });
  33. }
  34. Future getDetail() async {
  35. Map<String, dynamic> data =
  36. await HttpUtils.get(Api.profits + widget.fastId, params: {});
  37. setState(() {
  38. resultBean = FastResultBean.fromJson(data);
  39. });
  40. }
  41. @override
  42. Widget build(BuildContext context) {
  43. // ignore: unnecessary_null_comparison
  44. if (resultBean == null) {
  45. return Container(
  46. color: kBgColor,
  47. );
  48. }
  49. String resultTip = 'assets/images/challenge_failed.png';
  50. if (resultBean!.checkinStatus == 'SUCCESS') {
  51. resultTip = 'assets/images/challenge_success.png';
  52. } else if (resultBean!.checkinStatus == 'TIMEOUT') {
  53. resultTip = 'assets/images/challenge_done.png';
  54. }
  55. var size = MediaQuery.of(context).size;
  56. return Container(
  57. decoration: BoxDecoration(
  58. image: DecorationImage(
  59. image: AssetImage(
  60. 'assets/images/${resultBean!.days}day_result_bg.png'),
  61. fit: BoxFit.cover),
  62. ),
  63. alignment: Alignment.center,
  64. child: Column(
  65. children: [
  66. SizedBox(
  67. height: 54.px,
  68. ),
  69. Row(
  70. children: [
  71. GestureDetector(
  72. onTap: () {
  73. Navigator.of(context).pop();
  74. },
  75. child: Container(
  76. margin: EdgeInsets.only(left: 8.px,bottom: 11.px),
  77. alignment: Alignment.center,
  78. width: 44.px,
  79. height: 32.px,
  80. decoration: BoxDecoration(
  81. color: const Color(0x33000000),
  82. borderRadius: BorderRadius.all(Radius.circular(16.px)),
  83. border: Border.all(width: 1.px,color: const Color(0x33ffffff))
  84. ),
  85. child: Image.asset('assets/images/home.png',width: 20.px,height: 20.px,),
  86. ),
  87. )
  88. ],
  89. ),
  90. Opacity(
  91. opacity: 1.0,
  92. child: Image.asset(
  93. resultTip,
  94. width: 204.px,
  95. height: 72.px,
  96. ),
  97. ),
  98. SizedBox(
  99. height: 16.px,
  100. ),
  101. Opacity(
  102. opacity: 1.0,
  103. child: Container(
  104. width: 324.px,
  105. height: 260.px,
  106. decoration: BoxDecoration(
  107. color: const Color(0xCC000D1F),
  108. borderRadius: BorderRadius.all(Radius.circular(32.px)),
  109. border: Border.all(color: kThemeColor, width: 1.px),
  110. image: const DecorationImage(
  111. image: AssetImage('assets/images/statistic.png'),
  112. alignment: Alignment.topRight,
  113. scale: 2.9)),
  114. child: Statistic(
  115. resultBean: resultBean!,
  116. rate: 1.0,
  117. )),
  118. ),
  119. // SizedBox(
  120. // height: (1 - bottomAni.value) * 40.px + 20.px,
  121. // ),
  122. const Expanded(
  123. child: SizedBox(
  124. width: 0,
  125. height: 0,
  126. )),
  127. Opacity(
  128. opacity: 1,
  129. child: Column(
  130. children: [
  131. Text(
  132. '邀请好友注册成功',
  133. style: TextStyle(
  134. decoration: TextDecoration.none,
  135. fontWeight: FontWeight.normal,
  136. fontSize: 12.px,
  137. color: const Color(0x99FFFFFF)),
  138. ),
  139. SizedBox(
  140. height: 7.px,
  141. ),
  142. Row(
  143. mainAxisAlignment: MainAxisAlignment.center,
  144. children: [
  145. Text(
  146. '我和ta各得逆龄石',
  147. style: TextStyle(
  148. decoration: TextDecoration.none,
  149. fontWeight: FontWeight.normal,
  150. fontSize: 12.px,
  151. height: 1.0,
  152. color: const Color(0x99FFFFFF)),
  153. ),
  154. SizedBox(
  155. width: 2.px,
  156. ),
  157. Text(
  158. '+3',
  159. style: TextStyle(
  160. decoration: TextDecoration.none,
  161. fontWeight: FontWeight.w600,
  162. fontSize: 14.px,
  163. height: 1.0,
  164. fontFamily: 'Exo2',
  165. color: const Color(0x99FFFFFF)),
  166. ),
  167. SizedBox(
  168. width: 2.px,
  169. ),
  170. Image.asset(
  171. 'assets/images/stone.png',
  172. width: 14.px,
  173. height: 14.px,
  174. )
  175. ],
  176. ),
  177. GestureDetector(
  178. onTap: () {
  179. share();
  180. },
  181. child: Container(
  182. width: 228.px,
  183. height: 48.px,
  184. margin: EdgeInsets.only(top: 25.px, bottom: 12.px),
  185. decoration: BoxDecoration(
  186. borderRadius:
  187. BorderRadius.all(Radius.circular(24.px)),
  188. border: Border.all(color: kThemeColor, width: 1.px),
  189. image: const DecorationImage(
  190. image: AssetImage('assets/images/invite.png'),
  191. alignment: Alignment.center,
  192. scale: 1.8)),
  193. ),
  194. ),
  195. SizedBox(
  196. // height: 50.px,
  197. height: size.height < 812.px ? 54.px : 108.px,
  198. )
  199. ],
  200. ),
  201. )
  202. ],
  203. ));
  204. }
  205. }