set_page.dart 17 KB

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