YSMine.dart 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:ysairplane/code/YSCollection.dart';
  4. import 'package:ysairplane/code/YSFeedback.dart';
  5. import 'package:ysairplane/code/YSMoney.dart';
  6. import 'package:ysairplane/code/YSSetting.dart';
  7. import 'package:ysairplane/code/YSUserInfo.dart';
  8. import 'package:ysairplane/code/YSVipCode.dart';
  9. import 'package:ysairplane/tools/YSNetWorking.dart';
  10. import 'package:ysairplane/tools/YSTools.dart';
  11. import 'package:shared_preferences/shared_preferences.dart';
  12. class YSMine extends StatefulWidget {
  13. @override
  14. _YSMineState createState() => _YSMineState();
  15. }
  16. class _YSMineState extends State<YSMine> with AutomaticKeepAliveClientMixin{
  17. @override
  18. bool get wantKeepAlive => true;
  19. @override
  20. void initState() {
  21. Future.delayed(Duration(seconds: 0)).then((value){
  22. _getUserData();
  23. });
  24. super.initState();
  25. }
  26. @override
  27. Widget build(BuildContext context) {
  28. super.build(context);
  29. return Scaffold(
  30. backgroundColor: Color(0xFFF5F6F8),
  31. body: SingleChildScrollView(
  32. child: Column(
  33. children: [
  34. Container(
  35. height: MediaQuery.of(context).padding.top+200,
  36. width: MediaQuery.of(context).size.width,
  37. decoration: BoxDecoration(
  38. color: Color(0xFF00A8FF),
  39. // image: DecorationImage(
  40. // image: AssetImage('lib/images/top.png'),
  41. // fit: BoxFit.fill
  42. // ),
  43. ),
  44. child: Stack(
  45. children: [
  46. Container(
  47. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+30,left: MediaQuery.of(context).size.width-50),
  48. child: Icon(Icons.settings,size: 25,color: Colors.white,),
  49. ),
  50. Container(
  51. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+100,left: 20,right: 10),
  52. height: 70,
  53. width: 70,
  54. decoration: BoxDecoration(
  55. color: Colors.white,
  56. borderRadius: BorderRadius.all(Radius.circular(35))
  57. ),
  58. ),
  59. Container(
  60. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+110,left: 100),
  61. width: MediaQuery.of(context).size.width-150,
  62. child: Text('可乐西欧阿哥',style: TextStyle(fontSize: 18,color: Colors.white,fontWeight: FontWeight.bold),overflow: TextOverflow.ellipsis,),
  63. ),
  64. Container(
  65. margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+145,left: 100),
  66. child: Row(
  67. children: [
  68. Container(
  69. child: Row(
  70. children: [
  71. Text('177***8976',style: TextStyle(fontSize: 10,color: Colors.white),),
  72. Icon(Icons.keyboard_arrow_right,size: 15,color: Colors.white,),
  73. ],
  74. ),
  75. height: 20,
  76. alignment: Alignment.center,
  77. padding: EdgeInsets.only(left: 10,right: 5),
  78. decoration: BoxDecoration(
  79. color: Color(0xFF009DFF).withOpacity(0.6),
  80. borderRadius: BorderRadius.all(Radius.circular(10))
  81. ),
  82. ),
  83. GestureDetector(
  84. onTap: (){
  85. Navigator.of(context,rootNavigator: true).push(
  86. CupertinoPageRoute(
  87. builder: (context){
  88. return YSVipCode();
  89. }
  90. )
  91. );
  92. },
  93. child: Container(
  94. child: Row(
  95. children: [
  96. Icon(Icons.crop_square,size: 15,color: Colors.white,),
  97. Text('会员码',style: TextStyle(fontSize: 10,color: Colors.white),),
  98. ],
  99. ),
  100. height: 20,
  101. alignment: Alignment.center,
  102. margin: EdgeInsets.only(left: 5),
  103. padding: EdgeInsets.only(left: 5,right: 10),
  104. decoration: BoxDecoration(
  105. color: Color(0xFF009DFF).withOpacity(0.6),
  106. borderRadius: BorderRadius.all(Radius.circular(10))
  107. ),
  108. ),
  109. )
  110. ],
  111. )
  112. ),
  113. GestureDetector(
  114. onTap: (){
  115. Navigator.of(context,rootNavigator: true).push(
  116. CupertinoPageRoute(
  117. builder: (context){
  118. return YSUserInfo();
  119. }
  120. )
  121. );
  122. },
  123. child: Container(
  124. margin: EdgeInsets.only(left: MediaQuery.of(context).size.width-50,top: MediaQuery.of(context).padding.top+120),
  125. child: Icon(Icons.keyboard_arrow_right,size: 30,color: Colors.white,),
  126. ),
  127. )
  128. ],
  129. ),
  130. ),
  131. Container(
  132. child: ListView.separated(
  133. shrinkWrap: true,
  134. itemBuilder: (context,index){
  135. return GestureDetector(
  136. onTap: (){
  137. Navigator.of(context,rootNavigator: true).push(
  138. CupertinoPageRoute(
  139. builder: (context){
  140. return index==0?YSMoney():index==1?YSSetting():index==2?YSCollection():index==3?YSFeedback():YSSetting();
  141. }
  142. )
  143. );
  144. },
  145. child: Container(
  146. height: 50,
  147. color: Colors.white,
  148. padding: EdgeInsets.only(left: 15,right: 15),
  149. child: Row(
  150. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  151. children: [
  152. Row(
  153. children: [
  154. Container(
  155. child: Image.asset(index==0?'lib/images/money.png':index==1?'lib/images/travel.png':index==2?
  156. 'lib/images/collection.png':index==3?'lib/images/feedback.png':'lib/images/setting.png'),
  157. height: 20,
  158. width: 20,
  159. margin: EdgeInsets.only(right: 13),
  160. ),
  161. Text(index==0?'钱包':index==1?'行程':index==2?'收藏':index==3?'反馈':'设置',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),)
  162. ],
  163. ),
  164. Icon(Icons.keyboard_arrow_right,size: 25,color: Color(0xFFCDCDCD),)
  165. ],
  166. ),
  167. ),
  168. );
  169. },
  170. separatorBuilder: (context,index){
  171. return Container(
  172. color: Color(0xFFF5F6F8),
  173. height: index==0||index==3?10:0.5,
  174. );
  175. },
  176. itemCount: 5,
  177. padding: EdgeInsets.all(0),
  178. physics: NeverScrollableScrollPhysics(),
  179. ),
  180. )
  181. ],
  182. ),
  183. ),
  184. );
  185. }
  186. _getUserData() async{
  187. // ysRequestHttp(context, type: requestType.post, api: 'applets/user/center', parameter: {}, isLoading: false,refresh: (){
  188. // print('object1');
  189. // });
  190. }
  191. }