CheckinDialog.dart 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:wanna_battle/styles/colors.dart';
  4. import 'package:wanna_battle/styles/totast.dart';
  5. import '../styles/colors.dart';
  6. import '../widget/Dialog.dart';
  7. void showCheckinDialog(BuildContext context) {
  8. Navigator.of(context).push(
  9. PageRouteBuilder(
  10. opaque: false,
  11. transitionDuration: Duration(milliseconds: 300),
  12. transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
  13. return FadeTransition(
  14. opacity: CurvedAnimation(parent: animation, curve: Curves.linear),
  15. child: child,
  16. );
  17. },
  18. pageBuilder: (BuildContext context, _, __) {
  19. return _CheckinDialog1();
  20. },
  21. ),
  22. );
  23. }
  24. class _CheckinDialog1 extends Dialog {
  25. @override
  26. Widget build(BuildContext context) {
  27. return WillPopScope(
  28. child: Scaffold(
  29. backgroundColor: Color(0xb3000000),
  30. body: Container(
  31. child: SizedBox.expand(
  32. child: UnconstrainedBox(
  33. child: Container(
  34. width: 330,
  35. height: 390,
  36. decoration: BoxDecoration(color: Color(0xE6293559), border: Border.all(width: 1, color: Color(0xFF1990F8))),
  37. child: Column(
  38. crossAxisAlignment: CrossAxisAlignment.center,
  39. mainAxisAlignment: MainAxisAlignment.center,
  40. children: <Widget>[
  41. Text(
  42. '每日签到',
  43. style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
  44. ),
  45. Container(
  46. margin: EdgeInsets.only(top: 30),
  47. child: Row(
  48. mainAxisAlignment: MainAxisAlignment.center,
  49. children: <Widget>[
  50. item('星期一', 1, '50金币', 1),
  51. item('星期二', 1, '50金币', 2),
  52. item('星期三', 1, '50金币', 3),
  53. item('星期四', 1, '50金币', 1),
  54. ],
  55. ),
  56. ),
  57. Container(
  58. margin: EdgeInsets.only(top: 25),
  59. child: Row(
  60. mainAxisAlignment: MainAxisAlignment.center,
  61. children: <Widget>[
  62. item('星期五', 1, '50金币', 2),
  63. item('星期六', 1, '50金币', 3),
  64. item('星期日', 1, '50金币', 1),
  65. ],
  66. ),
  67. ),
  68. Container(
  69. margin: EdgeInsets.only(top: 40),
  70. child: MaterialButton(
  71. minWidth: 220,
  72. elevation: 0,
  73. highlightElevation: 0,
  74. color: PRIMARY_COLOR,
  75. child: Text(
  76. '立即签到',
  77. style: TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.bold),
  78. ),
  79. onPressed: () {
  80. Toast.show(context, '签到成功', 2000, 'info');
  81. Navigator.of(context).pop();
  82. },
  83. ),
  84. )
  85. ],
  86. ),
  87. ),
  88. ),
  89. ),
  90. ),
  91. ),
  92. onWillPop: () {
  93. return Future.value(true);
  94. },
  95. );
  96. }
  97. Widget item(String weekDay, int type, String name, int checked) {
  98. List<Widget> list = [
  99. Container(
  100. decoration: BoxDecoration(
  101. color: Color(0xFF253051),
  102. border: Border.all(width: 1, color: PRIMARY_COLOR),
  103. borderRadius: BorderRadius.circular(22),
  104. ),
  105. ),
  106. Center(
  107. child: Image.asset(
  108. 'images/icon_jinbi_qiandao.png',
  109. ),
  110. ),
  111. ];
  112. if (checked == 1) {
  113. list.add(Center(
  114. child: Image.asset(
  115. 'images/icon_yiqiandao.png',
  116. ),
  117. ));
  118. } else if (checked == 2) {
  119. list.add(Center(
  120. child: Container(
  121. decoration: BoxDecoration(
  122. color: Color(0xFF4f5c87),
  123. border: Border.all(width: 1, color: Color(0xFF4f5c87)),
  124. borderRadius: BorderRadius.circular(22),
  125. ),
  126. child: Center(
  127. child: Text(
  128. '未签到',
  129. style: TextStyle(color: Colors.white, fontSize: 10),
  130. ),
  131. ),
  132. ),
  133. ));
  134. }
  135. return Container(
  136. width: 76,
  137. child: Column(
  138. children: <Widget>[
  139. Container(
  140. width: 44,
  141. height: 44,
  142. child: Stack(
  143. children: list,
  144. ),
  145. ),
  146. Container(
  147. margin: EdgeInsets.only(top: 6),
  148. child: Text(
  149. weekDay,
  150. style: TextStyle(color: Colors.white, fontSize: 14),
  151. ),
  152. ),
  153. Container(
  154. margin: EdgeInsets.only(top: 2),
  155. child: Text(
  156. '50金币',
  157. style: TextStyle(
  158. color: PRIMARY_COLOR,
  159. fontSize: 12,
  160. ),
  161. ),
  162. )
  163. ],
  164. ),
  165. );
  166. }
  167. }