import 'dart:math' as math; import 'package:bbyyy/https/url.dart'; import 'package:bbyyy/my_tools/my_colors.dart'; import 'package:bbyyy/my_tools/my_cookie.dart'; import 'package:bbyyy/my_tools/my_tools.dart'; import 'package:bbyyy/my_tools/my_views.dart'; import 'package:bbyyy/paegs/login_page/login_page.dart'; import 'package:bbyyy/paegs/root_page/root_page_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'change_password_page.dart'; class SetPage extends StatefulWidget { @override _SetPageState createState() => _SetPageState(); } class _SetPageState extends State { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: Column( children: [ Container( decoration: BoxDecoration( gradient: LinearGradient(colors: MyColors.lg), ), height: 250, child: Column( children: [ SafeArea( bottom: false, child: Container( height: 45, width: double.infinity, color: Colors.transparent, child: Stack( children: [ Text( '设置', style: TextStyle(color: Colors.white, fontSize: 16), ), Positioned( left: 0, child: GestureDetector( onTap: () { Navigator.pop(context); }, behavior: HitTestBehavior.translucent, child: Transform.rotate( angle: math.pi, child: Padding( padding: EdgeInsets.only( left: 16, right: 16, top: 8, bottom: 8), child: SvgPicture.asset( 'images/svg/箭头.svg', color: Colors.white, height: 14, ), ), ), ), ), ], alignment: Alignment.center, ), ), ), Column( children: [ Container( margin: EdgeInsets.only(top: 34), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(35.5)), boxShadow: [ BoxShadow( color: MyColors.c7FE1E1E1, blurRadius: 5.0, ), ]), height: 71, width: 71, child: ClipRRect( child: MyViews().netImg( imgURL( MyCookie().loginInformation.data.extra.picture), 60, 60), borderRadius: BorderRadius.all(Radius.circular(30)), ), alignment: Alignment.center, ), Container( child: Text( MyCookie().loginInformation.data.extra.name, style: TextStyle(color: Colors.white, fontSize: 14), ), margin: EdgeInsets.only(top: 14), ) ], ) ], ), ), GestureDetector( onTap: () { MyTools().toPage(context, ChangePasswordPage(), (then) {}); }, behavior: HitTestBehavior.translucent, child: Container( padding: EdgeInsets.only(left: 20, right: 20), child: Column( children: [ Row( children: [ Container( child: SvgPicture.asset( 'images/svg/修改密码.svg', color: MyColors.c333333, ), margin: EdgeInsets.only(right: 12, top: 15, bottom: 15), ), Expanded( child: Text( '修改密码', style: TextStyle(color: MyColors.c333333, fontSize: 15), )), SvgPicture.asset('images/svg/箭头.svg') ], ), Container( height: 1, color: MyColors.cEFEFEF, ) ], ), ), ), Container( padding: EdgeInsets.only(left: 20, right: 20), child: Column( children: [ Row( children: [ Container( child: SvgPicture.asset( 'images/svg/收入进账提示音.svg', color: MyColors.c333333, ), margin: EdgeInsets.only(right: 12, top: 15, bottom: 15), ), Expanded( child: Text( '收入进账提示音', style: TextStyle(color: MyColors.c333333, fontSize: 15), )), CupertinoSwitch( activeColor: MyColors.cFF4233, value: MyCookie().prefs.getBool('收入进账提示音'), onChanged: (v) { MyCookie().prefs.setBool( '收入进账提示音', !MyCookie().prefs.getBool('收入进账提示音')); setState(() {}); }), ], ), Container( height: 1, color: MyColors.cEFEFEF, ) ], ), ), Container( padding: EdgeInsets.only(left: 20, right: 20), child: Column( children: [ Row( children: [ Container( child: SvgPicture.asset( 'images/svg/聊天新消息提示音.svg', color: MyColors.c333333, ), margin: EdgeInsets.only(right: 12, top: 15, bottom: 15), ), Expanded( child: Text( '聊天新消息提示音', style: TextStyle(color: MyColors.c333333, fontSize: 15), )), CupertinoSwitch( activeColor: MyColors.cFF4233, value: MyCookie().prefs.getBool('聊天新消息提示音'), onChanged: (v) { MyCookie().prefs.setBool('聊天新消息提示音', !MyCookie().prefs.getBool('聊天新消息提示音')); setState(() {}); }), ], ), Container( height: 1, color: MyColors.cEFEFEF, ) ], ), ), Container( margin: EdgeInsets.symmetric(vertical: 101, horizontal: 62), child: GestureDetector( onTap: () { showDialog( context: context, builder: (BuildContext context) { return WillPopScope( onWillPop: () { return Future.value(false); }, child: StreamBuilder(builder: (context, snapshot) { return Material( color: Colors.black12, child: Center( child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), color: Colors.white, ), height: 165, margin: EdgeInsets.symmetric(horizontal: 18), padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12), child: StatefulBuilder( builder: (BuildContext context, void Function(void Function()) setState) { return Column( children: [ Container( height: 88, child: MyViews().myText('确认退出登录重新登录吗?', MyColors.c333333, 14), margin: EdgeInsets.symmetric(horizontal: 20), alignment: Alignment.center, ), Container( height: 0.5, color: MyColors.cE7E7E7, margin: EdgeInsets.only(bottom: 12), ), Row( children: [ Expanded( child: GestureDetector( onTap: () { Navigator.pop(context); }, behavior: HitTestBehavior.translucent, child: Container( margin: EdgeInsets.only(left: 10), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(20), bottomLeft: Radius.circular(20), ), border: Border.all( color: MyColors.cFF4233, width: 1.1), color: Colors.white), child: MyViews().myText( '取消', MyColors.cFF4233, 14), height: 40, alignment: Alignment.center, ), ), ), Expanded( child: GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { MyCookie().prefs.remove('LoginInformationBeanEntity'); // MyCookie().prefs.clear(); RootPageView().bNIndex = 0; MyTools().toPage(context, LoginPage(), (then) {}, noBack: true); }, child: Container( margin: EdgeInsets.only(right: 10), decoration: BoxDecoration( borderRadius: BorderRadius.only( topRight: Radius.circular(20), bottomRight: Radius.circular(20), ), color: MyColors.cFF4233), height: 40, child: MyViews() .myText('确认', Colors.white, 14), alignment: Alignment.center, ), ), ) ], ) ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ); }, ), ), ), ); }), ); }, ); }, behavior: HitTestBehavior.translucent, child: Container( decoration: BoxDecoration( color: MyColors.cFF4233, borderRadius: BorderRadius.all(Radius.circular(22.5))), height: 45, child: Text( '退出登录', style: TextStyle(color: Colors.white, fontSize: 15), ), alignment: Alignment.center, ), ), ) ], ), ); } }