YSSetting.dart 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_wallet/generated/l10n.dart';
  4. import 'package:flutter_wallet/setting/YSAboutUs.dart';
  5. import 'package:flutter_wallet/setting/YSAlwayAddress.dart';
  6. import 'package:flutter_wallet/setting/YSSettingSystem.dart';
  7. import 'package:flutter_wallet/setting/YSShare.dart';
  8. import 'package:flutter_wallet/tools/YSColors.dart';
  9. import 'package:flutter_wallet/wallet/YSWalletManager.dart';
  10. import '../login/view/YSHelpView.dart';
  11. import '../tools/YSTools.dart';
  12. class YSSetting extends StatefulWidget {
  13. const YSSetting({Key? key}) : super(key: key);
  14. @override
  15. YSSettingState createState() => YSSettingState();
  16. }
  17. class YSSettingState extends State<YSSetting> {
  18. @override
  19. Widget build(BuildContext context) {
  20. List _menuArray = [
  21. {'image':'形状 3','title':S.current.GUANLIQIANBAO,'type':1},
  22. {'image':'地址 (2)','title':S.current.CHANGYONGDIZHI,'type':2},
  23. {'image':'moon-b-月亮备份','title':S.current.HEIANMOSHI,'type':3},
  24. {'image':'分享 (2)','title':S.current.FENXIANGYINGYONG,'type':4},
  25. // {'image':'说明 (1)','title':S.current.QIANBAOSHUOMING,'type':5},
  26. {'image':'关于我们 (2)','title':S.current.GUANYUMOMEN,'type':6},
  27. {'image':'形状结合 5','title':S.current.XITONGSHEZHI,'type':7}
  28. ];
  29. return Scaffold(
  30. body: SingleChildScrollView(
  31. child: SizedBox(
  32. width: ysWidth(context),
  33. child: Stack(
  34. children: [
  35. const YSHeadView(),
  36. Padding(
  37. padding: EdgeInsets.only(top: ysTOP(context)+hsp(10)),
  38. child: Column(
  39. children: [
  40. Container(
  41. height: hsp(50),
  42. padding: EdgeInsets.only(left: hsp(20),right: hsp(20)),
  43. child: Row(
  44. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  45. children: [
  46. Text(S.of(context).SHEZHI,style: YSColors.title2Style(context),),
  47. const YSCapsule()
  48. ],
  49. ),
  50. ),
  51. Container(
  52. margin: EdgeInsets.only(top: hsp(15)),
  53. height: ysHeight(context)-ysTOP(context)-147,
  54. decoration: BoxDecoration(
  55. color: YSColors.containColor(context),
  56. borderRadius: const BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10)),
  57. boxShadow: [
  58. BoxShadow(color: YSColors.shadowColor(context),blurRadius: 5)
  59. ]
  60. ),
  61. child: ListView.builder(
  62. itemBuilder: (context,index){
  63. Map item = _menuArray[index];
  64. return GestureDetector(
  65. onTap: (){
  66. int type = item['type'];
  67. switch(type){
  68. case 1:{
  69. Navigator.of(context).push(
  70. CupertinoPageRoute(builder: (context){
  71. return const YSWalletManager2();
  72. })
  73. );
  74. }break;
  75. case 2:{
  76. Navigator.of(context).push(
  77. CupertinoPageRoute(builder: (context){
  78. return const YSAlwayAddress();
  79. })
  80. );
  81. }break;
  82. case 4:{
  83. Navigator.of(context).push(
  84. CupertinoPageRoute(builder: (context){
  85. return const YSShare();
  86. })
  87. );
  88. }break;
  89. case 5:{
  90. }break;
  91. case 6:{
  92. Navigator.of(context).push(
  93. CupertinoPageRoute(builder: (context){
  94. return const YSAboutUs();
  95. })
  96. );
  97. }break;
  98. case 7:{
  99. Navigator.of(context).push(
  100. CupertinoPageRoute(builder: (context){
  101. return const YSSettingSystem();
  102. })
  103. ).then((value) {
  104. setState(() {});
  105. });
  106. }break;
  107. }
  108. },
  109. behavior: HitTestBehavior.opaque,
  110. child: Container(
  111. decoration: BoxDecoration(
  112. border: Border(bottom: BorderSide(color: YSColors.lineColor(context),width: 0.5))
  113. ),
  114. height: hsp(50)-0.5,
  115. child: Row(
  116. children: [
  117. Image.asset(YSColors.imageStyle(context, item['image']),height: hsp(10),width: hsp(10),),
  118. Expanded(
  119. child: Padding(
  120. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  121. child: Text(item['title'],style: YSColors.contentStyle(context),)
  122. )
  123. ),
  124. if(item['title']==S.current.HEIANMOSHI)YSSWitchView(valueSetter: (value){
  125. setThemFunc(context, value?darkTheme:lightTheme);
  126. String valueStr = value?'dart':'light';
  127. YSSharedPreferences.setStringValue('them',valueStr);
  128. YSUserRecord().them = valueStr;
  129. },type: 1,)
  130. ],
  131. ),
  132. ),
  133. );
  134. },
  135. itemCount: _menuArray.length,
  136. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  137. shrinkWrap: true,
  138. physics: const NeverScrollableScrollPhysics(),
  139. ),
  140. )
  141. ],
  142. ),
  143. )
  144. ],
  145. ),
  146. ),
  147. ),
  148. );
  149. }
  150. }