set_page.dart 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. import 'dart:math' as math;
  2. import 'package:bbyyy/https/url.dart';
  3. import 'package:bbyyy/my_tools/my_colors.dart';
  4. import 'package:bbyyy/my_tools/my_cookie.dart';
  5. import 'package:bbyyy/my_tools/my_tools.dart';
  6. import 'package:bbyyy/my_tools/my_views.dart';
  7. import 'package:bbyyy/paegs/login_page/login_page.dart';
  8. import 'package:bbyyy/paegs/root_page/root_page_view.dart';
  9. import 'package:flutter/cupertino.dart';
  10. import 'package:flutter/material.dart';
  11. import 'package:flutter_svg/svg.dart';
  12. import 'change_password_page.dart';
  13. class SetPage extends StatefulWidget {
  14. @override
  15. _SetPageState createState() => _SetPageState();
  16. }
  17. class _SetPageState extends State<SetPage> {
  18. @override
  19. Widget build(BuildContext context) {
  20. return Scaffold(
  21. backgroundColor: Colors.white,
  22. body: Column(
  23. children: [
  24. Container(
  25. decoration: BoxDecoration(
  26. gradient: LinearGradient(colors: MyColors.lg),
  27. ),
  28. height: 250,
  29. child: Column(
  30. children: [
  31. SafeArea(
  32. bottom: false,
  33. child: Container(
  34. height: 45,
  35. width: double.infinity,
  36. color: Colors.transparent,
  37. child: Stack(
  38. children: [
  39. Text(
  40. '设置',
  41. style: TextStyle(color: Colors.white, fontSize: 16),
  42. ),
  43. Positioned(
  44. left: 0,
  45. child: GestureDetector(
  46. onTap: () {
  47. Navigator.pop(context);
  48. },
  49. behavior: HitTestBehavior.translucent,
  50. child: Transform.rotate(
  51. angle: math.pi,
  52. child: Padding(
  53. padding: EdgeInsets.only(
  54. left: 16, right: 16, top: 8, bottom: 8),
  55. child: SvgPicture.asset(
  56. 'images/svg/箭头.svg',
  57. color: Colors.white,
  58. height: 14,
  59. ),
  60. ),
  61. ),
  62. ),
  63. ),
  64. ],
  65. alignment: Alignment.center,
  66. ),
  67. ),
  68. ),
  69. Column(
  70. children: [
  71. Container(
  72. margin: EdgeInsets.only(top: 34),
  73. decoration: BoxDecoration(
  74. color: Colors.white,
  75. borderRadius: BorderRadius.all(Radius.circular(35.5)),
  76. boxShadow: [
  77. BoxShadow(
  78. color: MyColors.c7FE1E1E1,
  79. blurRadius: 5.0,
  80. ),
  81. ]),
  82. height: 71,
  83. width: 71,
  84. child: ClipRRect(
  85. child: MyViews().netImg(
  86. imgURL(
  87. MyCookie().loginInformation.data.extra.picture),
  88. 60,
  89. 60),
  90. borderRadius: BorderRadius.all(Radius.circular(30)),
  91. ),
  92. alignment: Alignment.center,
  93. ),
  94. Container(
  95. child: Text(
  96. MyCookie().loginInformation.data.extra.name,
  97. style: TextStyle(color: Colors.white, fontSize: 14),
  98. ),
  99. margin: EdgeInsets.only(top: 14),
  100. )
  101. ],
  102. )
  103. ],
  104. ),
  105. ),
  106. GestureDetector(
  107. onTap: () {
  108. MyTools().toPage(context, ChangePasswordPage(), (then) {});
  109. },
  110. behavior: HitTestBehavior.translucent,
  111. child: Container(
  112. padding: EdgeInsets.only(left: 20, right: 20),
  113. child: Column(
  114. children: [
  115. Row(
  116. children: [
  117. Container(
  118. child: SvgPicture.asset(
  119. 'images/svg/修改密码.svg',
  120. color: MyColors.c333333,
  121. ),
  122. margin: EdgeInsets.only(right: 12, top: 15, bottom: 15),
  123. ),
  124. Expanded(
  125. child: Text(
  126. '修改密码',
  127. style: TextStyle(color: MyColors.c333333, fontSize: 15),
  128. )),
  129. SvgPicture.asset('images/svg/箭头.svg')
  130. ],
  131. ),
  132. Container(
  133. height: 1,
  134. color: MyColors.cEFEFEF,
  135. )
  136. ],
  137. ),
  138. ),
  139. ),
  140. Container(
  141. padding: EdgeInsets.only(left: 20, right: 20),
  142. child: Column(
  143. children: [
  144. Row(
  145. children: [
  146. Container(
  147. child: SvgPicture.asset(
  148. 'images/svg/收入进账提示音.svg',
  149. color: MyColors.c333333,
  150. ),
  151. margin: EdgeInsets.only(right: 12, top: 15, bottom: 15),
  152. ),
  153. Expanded(
  154. child: Text(
  155. '收入进账提示音',
  156. style: TextStyle(color: MyColors.c333333, fontSize: 15),
  157. )),
  158. CupertinoSwitch(
  159. activeColor: MyColors.cFF4233,
  160. value: MyCookie().prefs.getBool('收入进账提示音'),
  161. onChanged: (v) {
  162. MyCookie().prefs.setBool(
  163. '收入进账提示音', !MyCookie().prefs.getBool('收入进账提示音'));
  164. setState(() {});
  165. }),
  166. ],
  167. ),
  168. Container(
  169. height: 1,
  170. color: MyColors.cEFEFEF,
  171. )
  172. ],
  173. ),
  174. ),
  175. Container(
  176. padding: EdgeInsets.only(left: 20, right: 20),
  177. child: Column(
  178. children: [
  179. Row(
  180. children: [
  181. Container(
  182. child: SvgPicture.asset(
  183. 'images/svg/聊天新消息提示音.svg',
  184. color: MyColors.c333333,
  185. ),
  186. margin: EdgeInsets.only(right: 12, top: 15, bottom: 15),
  187. ),
  188. Expanded(
  189. child: Text(
  190. '聊天新消息提示音',
  191. style: TextStyle(color: MyColors.c333333, fontSize: 15),
  192. )),
  193. CupertinoSwitch(
  194. activeColor: MyColors.cFF4233,
  195. value: MyCookie().prefs.getBool('聊天新消息提示音'),
  196. onChanged: (v) {
  197. MyCookie().prefs.setBool('聊天新消息提示音',
  198. !MyCookie().prefs.getBool('聊天新消息提示音'));
  199. setState(() {});
  200. }),
  201. ],
  202. ),
  203. Container(
  204. height: 1,
  205. color: MyColors.cEFEFEF,
  206. )
  207. ],
  208. ),
  209. ),
  210. Container(
  211. margin: EdgeInsets.symmetric(vertical: 101, horizontal: 62),
  212. child: GestureDetector(
  213. onTap: () {
  214. showDialog(
  215. context: context,
  216. builder: (BuildContext context) {
  217. return WillPopScope(
  218. onWillPop: () {
  219. return Future.value(false);
  220. },
  221. child: StreamBuilder<Object>(builder: (context, snapshot) {
  222. return Material(
  223. color: Colors.black12,
  224. child: Center(
  225. child: Container(
  226. decoration: BoxDecoration(
  227. borderRadius: BorderRadius.circular(16),
  228. color: Colors.white,
  229. ),
  230. height: 165,
  231. margin: EdgeInsets.symmetric(horizontal: 18),
  232. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  233. child: StatefulBuilder(
  234. builder: (BuildContext context,
  235. void Function(void Function()) setState) {
  236. return Column(
  237. children: [
  238. Container(
  239. height: 88,
  240. child: MyViews().myText('确认退出登录重新登录吗?',
  241. MyColors.c333333,
  242. 14),
  243. margin: EdgeInsets.symmetric(horizontal: 20),
  244. alignment: Alignment.center,
  245. ),
  246. Container(
  247. height: 0.5,
  248. color: MyColors.cE7E7E7,
  249. margin: EdgeInsets.only(bottom: 12),
  250. ),
  251. Row(
  252. children: [
  253. Expanded(
  254. child: GestureDetector(
  255. onTap: () {
  256. Navigator.pop(context);
  257. },
  258. behavior: HitTestBehavior.translucent,
  259. child: Container(
  260. margin: EdgeInsets.only(left: 10),
  261. decoration: BoxDecoration(
  262. borderRadius: BorderRadius.only(
  263. topLeft: Radius.circular(20),
  264. bottomLeft: Radius.circular(20),
  265. ),
  266. border: Border.all(
  267. color: MyColors.cFF4233,
  268. width: 1.1),
  269. color: Colors.white),
  270. child: MyViews().myText(
  271. '取消', MyColors.cFF4233, 14),
  272. height: 40,
  273. alignment: Alignment.center,
  274. ),
  275. ),
  276. ),
  277. Expanded(
  278. child: GestureDetector(
  279. behavior: HitTestBehavior.translucent,
  280. onTap: () {
  281. MyCookie().prefs.remove('LoginInformationBeanEntity');
  282. // MyCookie().prefs.clear();
  283. RootPageView().bNIndex = 0;
  284. MyTools().toPage(context, LoginPage(), (then) {}, noBack: true);
  285. },
  286. child: Container(
  287. margin: EdgeInsets.only(right: 10),
  288. decoration: BoxDecoration(
  289. borderRadius: BorderRadius.only(
  290. topRight: Radius.circular(20),
  291. bottomRight:
  292. Radius.circular(20),
  293. ),
  294. color: MyColors.cFF4233),
  295. height: 40,
  296. child: MyViews()
  297. .myText('确认', Colors.white, 14),
  298. alignment: Alignment.center,
  299. ),
  300. ),
  301. )
  302. ],
  303. )
  304. ],
  305. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  306. );
  307. },
  308. ),
  309. ),
  310. ),
  311. );
  312. }),
  313. );
  314. },
  315. );
  316. },
  317. behavior: HitTestBehavior.translucent,
  318. child: Container(
  319. decoration: BoxDecoration(
  320. color: MyColors.cFF4233,
  321. borderRadius: BorderRadius.all(Radius.circular(22.5))),
  322. height: 45,
  323. child: Text(
  324. '退出登录',
  325. style: TextStyle(color: Colors.white, fontSize: 15),
  326. ),
  327. alignment: Alignment.center,
  328. ),
  329. ),
  330. )
  331. ],
  332. ),
  333. );
  334. }
  335. }