video_pay.dart 12 KB

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