import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:ysairplane/base/YSBase.dart'; import 'package:ysairplane/code/YSChangePayPass.dart'; import 'package:ysairplane/code/YSLogin.dart'; import 'package:ysairplane/code/YSSetPayPass.dart'; import 'package:ysairplane/tools/YSTools.dart'; import 'package:shared_preferences/shared_preferences.dart'; class YSSetting extends StatefulWidget { @override _YSSettingState createState() => _YSSettingState(); } class _YSSettingState extends State { bool _isOpen = false; @override Widget build(BuildContext context) { return YSBase( ystitle: '系统设置', yschild: Container( height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44, width: MediaQuery.of(context).size.width, color: Color(0xFFF5F6F8), child: Column( children: [ Container( margin: EdgeInsets.only(top: 10,bottom: 0.5), padding: EdgeInsets.only(left: 15,right: 15), height: 50, color: Colors.white, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('消息通知',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),), GestureDetector( onTap: (){ setState(() { _isOpen = !_isOpen; }); }, child: Container( height: hsp(60), width: hsp(100), child: Image.asset(_isOpen==false?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'), ), ) ], ), ), Container( padding: EdgeInsets.only(left: 15,right: 15), height: 50, color: Colors.white, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('清理缓存',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),), Row( children: [ Text('80M',style: TextStyle(fontSize: 16,color: Color(0xFF9A9A9A)),), Icon(Icons.keyboard_arrow_right,size: 20,color: Color(0xFF9A9A9A),) ], ) ], ), ), ListView.separated( itemBuilder: (context,index){ return GestureDetector( onTap: (){ Navigator.of(context).push( CupertinoPageRoute( builder: (context){ return index==0?YSSetPayPass():YSChangeOldPayPass(); } ) ); }, child: Container( padding: EdgeInsets.only(left: 15,right: 15), height: 50, color: Colors.white, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(index==0?'设置支付密码':'修改支付密码',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),), Icon(Icons.keyboard_arrow_right,size: 20,color: Color(0xFF9A9A9A),) ], ), ), ); }, separatorBuilder: (context,index){ return Divider(color: Color(0xFFF5F6F8),height: 0.5,thickness: 0.5,); }, itemCount: 2, padding: EdgeInsets.only(top: hsp(20)), shrinkWrap: true, physics: NeverScrollableScrollPhysics(), ), GestureDetector( child: Container( margin: EdgeInsets.only(top: 35), height: 45, width: MediaQuery.of(context).size.width-40, alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFF007AFF), borderRadius: BorderRadius.all(Radius.circular(6)) ), child: Text('退出当前账号',style: TextStyle(fontSize: 17,color: Colors.white,fontWeight: FontWeight.bold),), ), onTap: (){ Navigator.of(context).pushAndRemoveUntil( CupertinoPageRoute( builder: (context){ Future _prefer = SharedPreferences.getInstance(); _prefer.then((value){ value.remove('token'); }); return YSLogin(isOut: true,); } ), (route) => false); }, ) ], ), ), ); } }