set_page.dart 18 KB

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