|
|
@@ -1,3 +1,4 @@
|
|
|
+import 'package:flutter/cupertino.dart' as prefix0;
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
@@ -17,6 +18,7 @@ import '../net/HttpManager.dart';
|
|
|
import '../net/Result.dart';
|
|
|
import '../redux/UserRedux.dart';
|
|
|
import '../widget/Dialog.dart';
|
|
|
+import '../widget/LinearButton.dart';
|
|
|
|
|
|
class Setting extends StatefulWidget {
|
|
|
@override
|
|
|
@@ -46,86 +48,82 @@ class SettingState extends State<Setting> {
|
|
|
return WillPopScope(
|
|
|
key: Key('SettingsPage'),
|
|
|
child: Scaffold(
|
|
|
- backgroundColor: PAGE_BACKGROUND_COLOR,
|
|
|
+ backgroundColor: Color(0xFF2E3049),
|
|
|
appBar: AppBar(
|
|
|
- backgroundColor: PRIMARY_COLOR,
|
|
|
+ // backgroundColor: PRIMARY_COLOR,
|
|
|
title: Text('系统设置'),
|
|
|
centerTitle: true,
|
|
|
elevation: 0,
|
|
|
),
|
|
|
- body: Stack(
|
|
|
- children: <Widget>[
|
|
|
- RefreshIndicator(
|
|
|
- color: PRIMARY_COLOR,
|
|
|
- backgroundColor: Colors.white,
|
|
|
- displacement: 10,
|
|
|
- onRefresh: () async {
|
|
|
- await Future.delayed(const Duration(seconds: 1));
|
|
|
- getUserInfo();
|
|
|
- },
|
|
|
- child: SizedBox.expand(
|
|
|
- child: SingleChildScrollView(
|
|
|
- physics: AlwaysScrollableScrollPhysics(),
|
|
|
- child: Column(
|
|
|
- children: <Widget>[
|
|
|
- _sectionDivier(),
|
|
|
- _section([
|
|
|
- _cell(
|
|
|
- '是否接收消息',
|
|
|
- Switch(
|
|
|
- value: userInfo.noticeFlag,
|
|
|
- onChanged: (val) {
|
|
|
- updateUserInfo(userInfo, val ? 'Y' : 'N', 'noticeFlag');
|
|
|
- }),
|
|
|
- showBorder: false),
|
|
|
- _cell(
|
|
|
- '是否查看房间提醒',
|
|
|
- Switch(
|
|
|
- value: userInfo.remindFlag,
|
|
|
- onChanged: (val) {
|
|
|
- updateUserInfo(userInfo, val ? 'Y' : 'N', 'remindFlag');
|
|
|
- }),
|
|
|
- showBorder: false)
|
|
|
- ]),
|
|
|
- _sectionDivier(),
|
|
|
- _section([
|
|
|
- _cell('检查更新', ' ',onTap: (){
|
|
|
- MyDialog.showDialog(context, '您已是最新版本。');
|
|
|
- }),
|
|
|
- _cell('版本号', version, showBorder: false),
|
|
|
- ]),
|
|
|
- ],
|
|
|
+ body: RefreshIndicator(
|
|
|
+ color: PRIMARY_COLOR,
|
|
|
+ backgroundColor: Colors.white,
|
|
|
+ displacement: 10,
|
|
|
+ onRefresh: () async {
|
|
|
+ await Future.delayed(const Duration(seconds: 1));
|
|
|
+ getUserInfo();
|
|
|
+ },
|
|
|
+ child: SizedBox.expand(
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ physics: AlwaysScrollableScrollPhysics(),
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[
|
|
|
+ _sectionDivier(),
|
|
|
+ _section([
|
|
|
+ _cell(
|
|
|
+ '是否接收消息',
|
|
|
+ Switch(
|
|
|
+ value: userInfo.noticeFlag,
|
|
|
+ onChanged: (val) {
|
|
|
+ updateUserInfo(userInfo, val ? 'Y' : 'N', 'noticeFlag');
|
|
|
+ }),
|
|
|
+ showBorder: false),
|
|
|
+ _cell(
|
|
|
+ '是否查看房间提醒',
|
|
|
+ Switch(
|
|
|
+ value: userInfo.remindFlag,
|
|
|
+ onChanged: (val) {
|
|
|
+ updateUserInfo(userInfo, val ? 'Y' : 'N', 'remindFlag');
|
|
|
+ }),
|
|
|
+ showBorder: false)
|
|
|
+ ]),
|
|
|
+ _sectionDivier(),
|
|
|
+ _section([
|
|
|
+ _cell('检查更新', ' ', onTap: () {
|
|
|
+ MyDialog.showDialog(context, '您已是最新版本。');
|
|
|
+ }),
|
|
|
+ _cell('版本号', version, showBorder: false),
|
|
|
+ ]),
|
|
|
+ Container(
|
|
|
+ padding: EdgeInsets.fromLTRB(15, 60, 15, 30),
|
|
|
+ child: LinearButton(
|
|
|
+ btntext: '退出登录',
|
|
|
+ onTapHomeMenu: () async {
|
|
|
+ Toast.show(context, '退出成功', 1500, 'success');
|
|
|
+ Navigator.push(context, MaterialPageRoute(builder: (context) => LoginFirst()));
|
|
|
+ final prefs = await SharedPreferences.getInstance();
|
|
|
+ prefs.remove('token');
|
|
|
+ JPush jpush = JPush();
|
|
|
+ jpush.deleteAlias();
|
|
|
+ // Future.delayed(const Duration(seconds: 1), () {
|
|
|
+ // StoreProvider.of<AppState>(context).dispatch(UpdateUserAction(null));
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
+ ],
|
|
|
),
|
|
|
),
|
|
|
- Positioned(
|
|
|
- bottom: 10,
|
|
|
- right: 15,
|
|
|
- left: 15,
|
|
|
- height: 48,
|
|
|
- child: FlatButton(
|
|
|
- textColor: Colors.white,
|
|
|
- color: PRIMARY_COLOR,
|
|
|
- highlightColor: Color(0xFF763434),
|
|
|
- child: Text(
|
|
|
- '退出登录',
|
|
|
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.w700),
|
|
|
- ),
|
|
|
- onPressed: () async {
|
|
|
- Toast.show(context, '退出成功', 1500, 'success');
|
|
|
- Navigator.push(context, MaterialPageRoute(builder: (context) => LoginFirst()));
|
|
|
- final prefs = await SharedPreferences.getInstance();
|
|
|
- prefs.remove('token');
|
|
|
- JPush jpush = JPush();
|
|
|
- jpush.deleteAlias();
|
|
|
- // Future.delayed(const Duration(seconds: 1), () {
|
|
|
- // StoreProvider.of<AppState>(context).dispatch(UpdateUserAction(null));
|
|
|
- // });
|
|
|
- }),
|
|
|
- )
|
|
|
- ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ floatingActionButton: Container(
|
|
|
+ height: 100,
|
|
|
+ padding: EdgeInsets.symmetric(vertical: 30),
|
|
|
+ child: Column(
|
|
|
+ children: <Widget>[Text('Copyright©2019',style:TextStyle(color: Colors.white30,fontSize: 12)), Text('盛世明越(海南)科技有限公',style:TextStyle(color: Colors.white30,fontSize: 12))],
|
|
|
+ ),
|
|
|
),
|
|
|
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
),
|
|
|
onWillPop: () {
|
|
|
Toast.hide();
|
|
|
@@ -156,7 +154,7 @@ class SettingState extends State<Setting> {
|
|
|
} else {}
|
|
|
}
|
|
|
|
|
|
- Future<void> _chooseSex(BuildContext context) async {
|
|
|
+ Future<void> _chooseSex(BuildContext context) async {
|
|
|
String sex = await showCupertinoModalPopup(
|
|
|
context: context,
|
|
|
builder: (BuildContext context) {
|
|
|
@@ -270,12 +268,15 @@ class SettingState extends State<Setting> {
|
|
|
}
|
|
|
|
|
|
Widget _sectionDivier() {
|
|
|
- return SizedBox(height: 10);
|
|
|
+ return Container(
|
|
|
+ height: 10,
|
|
|
+ color: Color(0xFF24263A),
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
Widget _section(List<Widget> children) {
|
|
|
return Container(
|
|
|
- color: CELL_COLOR,
|
|
|
+ color: Color(0xFF2E3049),
|
|
|
child: Column(
|
|
|
children: children,
|
|
|
),
|
|
|
@@ -306,7 +307,7 @@ class SettingState extends State<Setting> {
|
|
|
decoration: BoxDecoration(
|
|
|
border: Border(
|
|
|
bottom: BorderSide(
|
|
|
- color: Color(0x2E000000),
|
|
|
+ color: Color(0xFF24263A),
|
|
|
width: showBorder ? 1 : 0,
|
|
|
),
|
|
|
),
|