video_pay.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:liftmanager/utils/toast.dart';
  4. import 'package:liftmanager/widgets/app_bar.dart';
  5. import 'package:liftmanager/widgets/load_image.dart';
  6. class VideoPay extends StatefulWidget {
  7. VideoPay(this.pay);
  8. final String pay;
  9. @override
  10. State<StatefulWidget> createState() {
  11. return VideoPayState();
  12. }
  13. }
  14. class VideoPayState extends State<VideoPay> {
  15. // ExpertListState({Key key}) : super(key: key);
  16. static const payType = [
  17. {
  18. "icon": "tab_first/pay_yue",
  19. "title": "账户余额",
  20. "price": "",
  21. },
  22. {
  23. "icon": "tab_first/pay_zhifubao",
  24. "title": "支付宝",
  25. },
  26. {
  27. "icon": "tab_first/pay_winxin",
  28. "title": "微信",
  29. },
  30. ];
  31. int indexNow = 999;
  32. String checkFalse = "tab_first/check_false";
  33. String checkTrue = "tab_first/check_true";
  34. @override
  35. Widget build(BuildContext context) {
  36. double width = MediaQuery.of(context).size.width;
  37. return Container(
  38. child: Scaffold(
  39. appBar: MyAppBar(
  40. centerTitle: "打赏",
  41. ),
  42. body: Container(
  43. child: Stack(
  44. children: <Widget>[
  45. Container(
  46. // padding: EdgeInsets.only(top:70),
  47. child: ListView(children: <Widget>[
  48. Container(
  49. padding: EdgeInsets.only(
  50. left: ScreenUtil().setWidth(15),
  51. right: ScreenUtil().setWidth(15),
  52. top: ScreenUtil().setWidth(15),
  53. bottom: ScreenUtil().setWidth(15)),
  54. decoration: BoxDecoration(
  55. border: Border(
  56. bottom:
  57. BorderSide(width: 5, color: Color(0xfff5f5f5)),
  58. ),
  59. ),
  60. child: Row(
  61. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  62. children: <Widget>[
  63. Row(
  64. crossAxisAlignment: CrossAxisAlignment.center,
  65. children: <Widget>[
  66. Text(
  67. "学堂打赏",
  68. style: TextStyle(
  69. color: Color(0xff333333),
  70. fontSize: ScreenUtil().setSp(16)),
  71. textAlign: TextAlign.start,
  72. ),
  73. Container(
  74. padding: EdgeInsets.only(
  75. left: ScreenUtil().setWidth(10)),
  76. child: Text(
  77. "小小维修工",
  78. style: TextStyle(
  79. color: Color(0xff666666),
  80. fontSize: ScreenUtil().setSp(16)),
  81. textAlign: TextAlign.start,
  82. ),
  83. )
  84. ]),
  85. Container(
  86. child: Text(
  87. "¥${widget.pay}",
  88. style: TextStyle(
  89. color: Colors.red,
  90. fontSize: ScreenUtil().setSp(16)),
  91. textAlign: TextAlign.end,
  92. ),
  93. )
  94. ])),
  95. Container(
  96. padding: EdgeInsets.only(
  97. left: ScreenUtil().setWidth(15),
  98. right: ScreenUtil().setWidth(15),
  99. top: ScreenUtil().setWidth(15),
  100. bottom: ScreenUtil().setWidth(15)),
  101. decoration: BoxDecoration(
  102. border: Border(
  103. bottom: BorderSide(width: 5, color: Color(0xfff5f5f5)),
  104. ),
  105. ),
  106. child: Row(
  107. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  108. children: <Widget>[
  109. Text(
  110. "共需支付",
  111. style: TextStyle(
  112. color: Color(0xff222222),
  113. fontSize: ScreenUtil().setSp(16)),
  114. textAlign: TextAlign.start,
  115. ),
  116. Text(
  117. "¥${widget.pay}",
  118. style: TextStyle(
  119. color: Colors.red,
  120. fontSize: ScreenUtil().setSp(16)),
  121. textAlign: TextAlign.start,
  122. ),
  123. ]),
  124. ),
  125. Container(
  126. padding: EdgeInsets.only(
  127. left: ScreenUtil().setWidth(15),
  128. right: ScreenUtil().setWidth(15),
  129. top: ScreenUtil().setWidth(100),
  130. bottom: ScreenUtil().setWidth(10)),
  131. decoration: BoxDecoration(
  132. border: Border(
  133. bottom:
  134. BorderSide(width: 0.5, color: Color(0xfff5f5f5)),
  135. ),
  136. ),
  137. child: Row(
  138. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  139. children: <Widget>[
  140. Text(
  141. "选择支付方式",
  142. style: TextStyle(
  143. color: Color(0xff000000),
  144. fontSize: ScreenUtil().setSp(16)),
  145. textAlign: TextAlign.start,
  146. ),
  147. ]),
  148. ),
  149. Container(
  150. padding: EdgeInsets.only(
  151. left: ScreenUtil().setWidth(15),
  152. right: ScreenUtil().setWidth(15)),
  153. child: Column(
  154. children: payType.asMap().keys.map((i) {
  155. return Container(
  156. decoration: BoxDecoration(
  157. border: Border(
  158. bottom: BorderSide(
  159. width: 0.5, color: Color(0xfff5f5f5)),
  160. ),
  161. ),
  162. height: 60,
  163. child: Row(
  164. mainAxisAlignment:
  165. MainAxisAlignment.spaceBetween,
  166. children: <Widget>[
  167. Row(
  168. children: <Widget>[
  169. LoadAssetImage(
  170. // image: AssetImage(i['img']),
  171. payType[i]["icon"],
  172. width: ScreenUtil().setWidth(26),
  173. height: ScreenUtil().setWidth(26),
  174. // alignment: Alignment.centerLeft,
  175. ),
  176. Container(width: 5, child: null),
  177. Text(
  178. payType[i]["title"],
  179. style: TextStyle(
  180. color: Color(0xff000000),
  181. fontSize: ScreenUtil().setSp(16)),
  182. textAlign: TextAlign.start,
  183. ),
  184. Container(width: 5, child: null),
  185. Text(
  186. payType[i]["price"] != null
  187. ? "¥${payType[i]["price"]}"
  188. : "",
  189. style: TextStyle(
  190. color: Color(0xff999999),
  191. fontSize: ScreenUtil().setSp(16)),
  192. textAlign: TextAlign.start,
  193. ),
  194. ],
  195. ),
  196. InkWell(
  197. child: Container(
  198. // padding: EdgeInsets.only(top:10,left:5,right:5,bottom:10),
  199. child: LoadAssetImage(
  200. // image: AssetImage(i['img']),
  201. indexNow == i
  202. ? checkTrue
  203. : checkFalse,
  204. width: ScreenUtil().setWidth(20),
  205. height: ScreenUtil().setWidth(20),
  206. // alignment: Alignment.centerLeft,
  207. ),
  208. ),
  209. onTap: () {
  210. setState(() {
  211. indexNow = i;
  212. });
  213. print(indexNow);
  214. },
  215. ),
  216. ]));
  217. }).toList(),
  218. ))
  219. ]),
  220. ),
  221. Positioned(
  222. bottom: 0,
  223. left: 0,
  224. child: Container(
  225. width: width,
  226. padding: EdgeInsets.only(
  227. top: ScreenUtil().setWidth(15),
  228. bottom: ScreenUtil().setWidth(15),
  229. left: ScreenUtil().setWidth(25),
  230. right: ScreenUtil().setWidth(25)),
  231. color: Colors.white,
  232. child: Container(
  233. height: ScreenUtil().setWidth(44),
  234. decoration: BoxDecoration(
  235. borderRadius:
  236. BorderRadius.circular(ScreenUtil().setWidth(22)),
  237. gradient: const LinearGradient(
  238. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)]),
  239. ),
  240. child: FlatButton(
  241. // padding: EdgeInsets.all(15.0),
  242. child: Text("立即支付"),
  243. textColor: Colors.white,
  244. onPressed: () {
  245. toasts("支付成功");
  246. Navigator.pop(context);
  247. },
  248. ),
  249. ),
  250. ))
  251. ],
  252. ))),
  253. );
  254. }
  255. }