set_page.dart 17 KB

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