YSSetting.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:ysairplane/base/YSBase.dart';
  4. import 'package:ysairplane/code/YSChangePayPass.dart';
  5. import 'package:ysairplane/code/YSLogin.dart';
  6. import 'package:ysairplane/code/YSSetPayPass.dart';
  7. import 'package:ysairplane/tools/YSTools.dart';
  8. import 'package:shared_preferences/shared_preferences.dart';
  9. class YSSetting extends StatefulWidget {
  10. @override
  11. _YSSettingState createState() => _YSSettingState();
  12. }
  13. class _YSSettingState extends State<YSSetting> {
  14. bool _isOpen = false;
  15. @override
  16. Widget build(BuildContext context) {
  17. return YSBase(
  18. ystitle: '系统设置',
  19. yschild: Container(
  20. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
  21. width: MediaQuery.of(context).size.width,
  22. color: Color(0xFFF5F6F8),
  23. child: Column(
  24. children: [
  25. Container(
  26. margin: EdgeInsets.only(top: 10,bottom: 0.5),
  27. padding: EdgeInsets.only(left: 15,right: 15),
  28. height: 50,
  29. color: Colors.white,
  30. child: Row(
  31. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  32. children: [
  33. Text('消息通知',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),),
  34. GestureDetector(
  35. onTap: (){
  36. setState(() {
  37. _isOpen = !_isOpen;
  38. });
  39. },
  40. child: Container(
  41. height: hsp(60),
  42. width: hsp(100),
  43. child: Image.asset(_isOpen==false?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'),
  44. ),
  45. )
  46. ],
  47. ),
  48. ),
  49. Container(
  50. padding: EdgeInsets.only(left: 15,right: 15),
  51. height: 50,
  52. color: Colors.white,
  53. child: Row(
  54. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  55. children: [
  56. Text('清理缓存',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),),
  57. Row(
  58. children: [
  59. Text('80M',style: TextStyle(fontSize: 16,color: Color(0xFF9A9A9A)),),
  60. Icon(Icons.keyboard_arrow_right,size: 20,color: Color(0xFF9A9A9A),)
  61. ],
  62. )
  63. ],
  64. ),
  65. ),
  66. ListView.separated(
  67. itemBuilder: (context,index){
  68. return GestureDetector(
  69. onTap: (){
  70. Navigator.of(context).push(
  71. CupertinoPageRoute(
  72. builder: (context){
  73. return index==0?YSSetPayPass():YSChangeOldPayPass();
  74. }
  75. )
  76. );
  77. },
  78. child: Container(
  79. padding: EdgeInsets.only(left: 15,right: 15),
  80. height: 50,
  81. color: Colors.white,
  82. child: Row(
  83. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  84. children: [
  85. Text(index==0?'设置支付密码':'修改支付密码',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),),
  86. Icon(Icons.keyboard_arrow_right,size: 20,color: Color(0xFF9A9A9A),)
  87. ],
  88. ),
  89. ),
  90. );
  91. },
  92. separatorBuilder: (context,index){
  93. return Divider(color: Color(0xFFF5F6F8),height: 0.5,thickness: 0.5,);
  94. },
  95. itemCount: 2,
  96. padding: EdgeInsets.only(top: hsp(20)),
  97. shrinkWrap: true,
  98. physics: NeverScrollableScrollPhysics(),
  99. ),
  100. GestureDetector(
  101. child: Container(
  102. margin: EdgeInsets.only(top: 35),
  103. height: 45,
  104. width: MediaQuery.of(context).size.width-40,
  105. alignment: Alignment.center,
  106. decoration: BoxDecoration(
  107. color: Color(0xFF007AFF),
  108. borderRadius: BorderRadius.all(Radius.circular(6))
  109. ),
  110. child: Text('退出当前账号',style: TextStyle(fontSize: 17,color: Colors.white,fontWeight: FontWeight.bold),),
  111. ),
  112. onTap: (){
  113. Navigator.of(context).pushAndRemoveUntil(
  114. CupertinoPageRoute(
  115. builder: (context){
  116. Future<SharedPreferences> _prefer = SharedPreferences.getInstance();
  117. _prefer.then((value){
  118. value.remove('token');
  119. });
  120. return YSLogin(isOut: true,);
  121. }
  122. ), (route) => false);
  123. },
  124. )
  125. ],
  126. ),
  127. ),
  128. );
  129. }
  130. }