import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:ysairplane/code/YSCollection.dart'; import 'package:ysairplane/code/YSFeedback.dart'; import 'package:ysairplane/code/YSMoney.dart'; import 'package:ysairplane/code/YSSetting.dart'; import 'package:ysairplane/code/YSUserInfo.dart'; import 'package:ysairplane/code/YSVipCode.dart'; import 'package:ysairplane/tools/YSNetWorking.dart'; import 'package:ysairplane/tools/YSTools.dart'; import 'package:shared_preferences/shared_preferences.dart'; class YSMine extends StatefulWidget { @override _YSMineState createState() => _YSMineState(); } class _YSMineState extends State with AutomaticKeepAliveClientMixin{ @override bool get wantKeepAlive => true; @override void initState() { Future.delayed(Duration(seconds: 0)).then((value){ _getUserData(); }); super.initState(); } @override Widget build(BuildContext context) { super.build(context); return Scaffold( backgroundColor: Color(0xFFF5F6F8), body: SingleChildScrollView( child: Column( children: [ Container( height: MediaQuery.of(context).padding.top+200, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( color: Color(0xFF00A8FF), // image: DecorationImage( // image: AssetImage('lib/images/top.png'), // fit: BoxFit.fill // ), ), child: Stack( children: [ Container( margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+30,left: MediaQuery.of(context).size.width-50), child: Icon(Icons.settings,size: 25,color: Colors.white,), ), Container( margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+100,left: 20,right: 10), height: 70, width: 70, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(35)) ), ), Container( margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+110,left: 100), width: MediaQuery.of(context).size.width-150, child: Text('可乐西欧阿哥',style: TextStyle(fontSize: 18,color: Colors.white,fontWeight: FontWeight.bold),overflow: TextOverflow.ellipsis,), ), Container( margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+145,left: 100), child: Row( children: [ Container( child: Row( children: [ Text('177***8976',style: TextStyle(fontSize: 10,color: Colors.white),), Icon(Icons.keyboard_arrow_right,size: 15,color: Colors.white,), ], ), height: 20, alignment: Alignment.center, padding: EdgeInsets.only(left: 10,right: 5), decoration: BoxDecoration( color: Color(0xFF009DFF).withOpacity(0.6), borderRadius: BorderRadius.all(Radius.circular(10)) ), ), GestureDetector( onTap: (){ Navigator.of(context,rootNavigator: true).push( CupertinoPageRoute( builder: (context){ return YSVipCode(); } ) ); }, child: Container( child: Row( children: [ Icon(Icons.crop_square,size: 15,color: Colors.white,), Text('会员码',style: TextStyle(fontSize: 10,color: Colors.white),), ], ), height: 20, alignment: Alignment.center, margin: EdgeInsets.only(left: 5), padding: EdgeInsets.only(left: 5,right: 10), decoration: BoxDecoration( color: Color(0xFF009DFF).withOpacity(0.6), borderRadius: BorderRadius.all(Radius.circular(10)) ), ), ) ], ) ), GestureDetector( onTap: (){ Navigator.of(context,rootNavigator: true).push( CupertinoPageRoute( builder: (context){ return YSUserInfo(); } ) ); }, child: Container( margin: EdgeInsets.only(left: MediaQuery.of(context).size.width-50,top: MediaQuery.of(context).padding.top+120), child: Icon(Icons.keyboard_arrow_right,size: 30,color: Colors.white,), ), ) ], ), ), Container( child: ListView.separated( shrinkWrap: true, itemBuilder: (context,index){ return GestureDetector( onTap: (){ Navigator.of(context,rootNavigator: true).push( CupertinoPageRoute( builder: (context){ return index==0?YSMoney():index==1?YSSetting():index==2?YSCollection():index==3?YSFeedback():YSSetting(); } ) ); }, child: Container( height: 50, color: Colors.white, padding: EdgeInsets.only(left: 15,right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Container( child: Image.asset(index==0?'lib/images/money.png':index==1?'lib/images/travel.png':index==2? 'lib/images/collection.png':index==3?'lib/images/feedback.png':'lib/images/setting.png'), height: 20, width: 20, margin: EdgeInsets.only(right: 13), ), Text(index==0?'钱包':index==1?'行程':index==2?'收藏':index==3?'反馈':'设置',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),) ], ), Icon(Icons.keyboard_arrow_right,size: 25,color: Color(0xFFCDCDCD),) ], ), ), ); }, separatorBuilder: (context,index){ return Container( color: Color(0xFFF5F6F8), height: index==0||index==3?10:0.5, ); }, itemCount: 5, padding: EdgeInsets.all(0), physics: NeverScrollableScrollPhysics(), ), ) ], ), ), ); } _getUserData() async{ // ysRequestHttp(context, type: requestType.post, api: 'applets/user/center', parameter: {}, isLoading: false,refresh: (){ // print('object1'); // }); } }