|
@@ -11,10 +11,14 @@ import 'dart:async';
|
|
|
import 'dart:convert';
|
|
import 'dart:convert';
|
|
|
import 'dart:ui';
|
|
import 'dart:ui';
|
|
|
import '../styles/totast.dart';
|
|
import '../styles/totast.dart';
|
|
|
-import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
|
-import '../state.dart';
|
|
|
|
|
-import 'changeUserInfo.dart'; //修改信息页面
|
|
|
|
|
|
|
+import 'ChangeUserInfo.dart'; //修改信息页面
|
|
|
import 'loginFirst.dart'; //登录
|
|
import 'loginFirst.dart'; //登录
|
|
|
|
|
+import 'package:redux/redux.dart';
|
|
|
|
|
+import 'package:flutter_redux/flutter_redux.dart';
|
|
|
|
|
+import '../redux/AppState.dart';
|
|
|
|
|
+import '../model/UserInfo.dart';
|
|
|
|
|
+import '../net/HttpManager.dart';
|
|
|
|
|
+import '../net/Result.dart';
|
|
|
|
|
|
|
|
class Setting extends StatefulWidget {
|
|
class Setting extends StatefulWidget {
|
|
|
@override
|
|
@override
|
|
@@ -22,144 +26,131 @@ class Setting extends StatefulWidget {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class SettingState extends State<Setting> {
|
|
class SettingState extends State<Setting> {
|
|
|
- Map userInfo = {};
|
|
|
|
|
-
|
|
|
|
|
- Future getImage() async {
|
|
|
|
|
|
|
+ Future getImage(userInfo) async {
|
|
|
var image = await FilePicker.getFilePath(type: FileType.IMAGE);
|
|
var image = await FilePicker.getFilePath(type: FileType.IMAGE);
|
|
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
File _image = File(image);
|
|
File _image = File(image);
|
|
|
_image.readAsBytes().then((bytes) async {
|
|
_image.readAsBytes().then((bytes) async {
|
|
|
String encoded1 = 'data:image/jpeg;base64,' + base64Encode(bytes);
|
|
String encoded1 = 'data:image/jpeg;base64,' + base64Encode(bytes);
|
|
|
- print(encoded1);
|
|
|
|
|
FormData formData = new FormData.from({"base64": encoded1});
|
|
FormData formData = new FormData.from({"base64": encoded1});
|
|
|
- Toast.show(context, '加载中', -1, 'loading');
|
|
|
|
|
final response =
|
|
final response =
|
|
|
await Dio().post(domain + 'assets/uploadImg', data: formData);
|
|
await Dio().post(domain + 'assets/uploadImg', data: formData);
|
|
|
final res = json.decode(response.toString());
|
|
final res = json.decode(response.toString());
|
|
|
if (res['success']) {
|
|
if (res['success']) {
|
|
|
- updateUserInfo(res['data'], 'icon');
|
|
|
|
|
|
|
+ updateUserInfo(userInfo, res['data'], 'icon');
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @override
|
|
|
|
|
- void initState() {
|
|
|
|
|
- super.initState();
|
|
|
|
|
-
|
|
|
|
|
- // getUserInfo(false);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @override
|
|
|
|
|
- void didChangeDependencies() {
|
|
|
|
|
- super.didChangeDependencies();
|
|
|
|
|
- userInfo = StoreProvider.of<CountState>(context).state.userInfo;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
|
|
ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
|
|
|
- return new WillPopScope(
|
|
|
|
|
- child: Scaffold(
|
|
|
|
|
- appBar: AppBar(
|
|
|
|
|
- backgroundColor: PRIMARY_COLOR,
|
|
|
|
|
- title: Text('系统设置'),
|
|
|
|
|
- centerTitle: true,
|
|
|
|
|
- elevation: 0,
|
|
|
|
|
- ),
|
|
|
|
|
- body: Stack(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- RefreshIndicator(
|
|
|
|
|
- color: PRIMARY_COLOR,
|
|
|
|
|
- backgroundColor: BG_SUB_COLOR,
|
|
|
|
|
- displacement: 10,
|
|
|
|
|
- onRefresh: () async {
|
|
|
|
|
- await new Future.delayed(const Duration(seconds: 1));
|
|
|
|
|
- getUserInfo(false);
|
|
|
|
|
- },
|
|
|
|
|
- child: SingleChildScrollView(
|
|
|
|
|
- physics: AlwaysScrollableScrollPhysics(),
|
|
|
|
|
- child: ConstrainedBox(
|
|
|
|
|
- constraints: BoxConstraints(
|
|
|
|
|
- minHeight: window.physicalSize.height /
|
|
|
|
|
- window.devicePixelRatio -
|
|
|
|
|
- 56 -
|
|
|
|
|
- MediaQueryData.fromWindow(window)
|
|
|
|
|
- .padding
|
|
|
|
|
- .top),
|
|
|
|
|
- child: Container(
|
|
|
|
|
- padding: EdgeInsets.only(bottom: 100),
|
|
|
|
|
- color: BG_COLOR,
|
|
|
|
|
- child: Column(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- Container(
|
|
|
|
|
- color: BG_SUB_COLOR,
|
|
|
|
|
- padding: EdgeInsets.only(top: 10),
|
|
|
|
|
|
|
+ return StoreConnector<AppState, UserInfo>(
|
|
|
|
|
+ converter: (Store store) => store.state.userInfo,
|
|
|
|
|
+ builder: (context, userInfo) {
|
|
|
|
|
+ return new WillPopScope(
|
|
|
|
|
+ child: Scaffold(
|
|
|
|
|
+ appBar: AppBar(
|
|
|
|
|
+ backgroundColor: PRIMARY_COLOR,
|
|
|
|
|
+ title: Text('系统设置'),
|
|
|
|
|
+ centerTitle: true,
|
|
|
|
|
+ elevation: 0,
|
|
|
|
|
+ ),
|
|
|
|
|
+ body: Stack(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ RefreshIndicator(
|
|
|
|
|
+ color: PRIMARY_COLOR,
|
|
|
|
|
+ backgroundColor: BG_SUB_COLOR,
|
|
|
|
|
+ displacement: 10,
|
|
|
|
|
+ onRefresh: () async {
|
|
|
|
|
+ await new Future.delayed(
|
|
|
|
|
+ const Duration(seconds: 1));
|
|
|
|
|
+ getUserInfo();
|
|
|
|
|
+ },
|
|
|
|
|
+ child: SingleChildScrollView(
|
|
|
|
|
+ physics: AlwaysScrollableScrollPhysics(),
|
|
|
|
|
+ child: ConstrainedBox(
|
|
|
|
|
+ constraints: BoxConstraints(
|
|
|
|
|
+ minHeight: window.physicalSize.height /
|
|
|
|
|
+ window.devicePixelRatio -
|
|
|
|
|
+ 56 -
|
|
|
|
|
+ MediaQueryData.fromWindow(window)
|
|
|
|
|
+ .padding
|
|
|
|
|
+ .top),
|
|
|
|
|
+ child: Container(
|
|
|
|
|
+ padding: EdgeInsets.only(bottom: 100),
|
|
|
|
|
+ color: BG_COLOR,
|
|
|
child: Column(
|
|
child: Column(
|
|
|
children: <Widget>[
|
|
children: <Widget>[
|
|
|
- _settingItem('头像', true),
|
|
|
|
|
- _settingItem('昵称', true),
|
|
|
|
|
- _settingItem('性别', true),
|
|
|
|
|
- _settingItem('生日', true),
|
|
|
|
|
- _settingItem('手机', false),
|
|
|
|
|
|
|
+ Container(
|
|
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
|
|
+ padding: EdgeInsets.only(top: 10),
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ _settingItem(userInfo, '头像', true),
|
|
|
|
|
+ _settingItem(userInfo, '昵称', true),
|
|
|
|
|
+ _settingItem(userInfo, '性别', true),
|
|
|
|
|
+ _settingItem(userInfo, '生日', true),
|
|
|
|
|
+ _settingItem(userInfo, '手机', false),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
|
|
+ padding: EdgeInsets.only(top: 10),
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ _settingItem(
|
|
|
|
|
+ userInfo, '是否接受消息提示', false),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Container(
|
|
|
|
|
+ color: BG_SUB_COLOR,
|
|
|
|
|
+ padding: EdgeInsets.only(top: 10),
|
|
|
|
|
+ child: Column(
|
|
|
|
|
+ children: <Widget>[
|
|
|
|
|
+ _settingItem(
|
|
|
|
|
+ userInfo, '检查更新', true),
|
|
|
|
|
+ _settingItem(
|
|
|
|
|
+ userInfo, '版本号', false),
|
|
|
|
|
+ ],
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
- Container(
|
|
|
|
|
- color: BG_SUB_COLOR,
|
|
|
|
|
- padding: EdgeInsets.only(top: 10),
|
|
|
|
|
- child: Column(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- _settingItem('是否接受消息提示', false),
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- Container(
|
|
|
|
|
- color: BG_SUB_COLOR,
|
|
|
|
|
- padding: EdgeInsets.only(top: 10),
|
|
|
|
|
- child: Column(
|
|
|
|
|
- children: <Widget>[
|
|
|
|
|
- _settingItem('检查更新', true),
|
|
|
|
|
- _settingItem('版本号', false),
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- ),
|
|
|
|
|
- ),
|
|
|
|
|
- ))),
|
|
|
|
|
- Positioned(
|
|
|
|
|
- bottom: 10,
|
|
|
|
|
- width: ScreenUtil().setWidth(345),
|
|
|
|
|
- left: ScreenUtil().setWidth(15),
|
|
|
|
|
- height: 48,
|
|
|
|
|
- child: FlatButton(
|
|
|
|
|
- textColor: Colors.white,
|
|
|
|
|
- color: PRIMARY_COLOR,
|
|
|
|
|
- highlightColor: Color(0xFF763434),
|
|
|
|
|
- child: Text("退出登录"),
|
|
|
|
|
- onPressed: () {
|
|
|
|
|
- print('退出登录');
|
|
|
|
|
- StoreProvider.of<CountState>(context).dispatch({
|
|
|
|
|
- "action": Actions.updateAll,
|
|
|
|
|
- "token": "",
|
|
|
|
|
- "user": {}
|
|
|
|
|
- });
|
|
|
|
|
- Toast.show(context, '退出成功', 1500, 'success');
|
|
|
|
|
- Navigator.push(
|
|
|
|
|
- context,
|
|
|
|
|
- new MaterialPageRoute(
|
|
|
|
|
- builder: (context) => new LoginFirst()));
|
|
|
|
|
- }),
|
|
|
|
|
- )
|
|
|
|
|
- ],
|
|
|
|
|
- )),
|
|
|
|
|
- onWillPop: () {
|
|
|
|
|
- Toast.hide();
|
|
|
|
|
- print("返回键点击了");
|
|
|
|
|
- Navigator.pop(context);
|
|
|
|
|
|
|
+ ))),
|
|
|
|
|
+ Positioned(
|
|
|
|
|
+ bottom: 10,
|
|
|
|
|
+ width: ScreenUtil().setWidth(345),
|
|
|
|
|
+ left: ScreenUtil().setWidth(15),
|
|
|
|
|
+ height: 48,
|
|
|
|
|
+ child: FlatButton(
|
|
|
|
|
+ textColor: Colors.white,
|
|
|
|
|
+ color: PRIMARY_COLOR,
|
|
|
|
|
+ highlightColor: Color(0xFF763434),
|
|
|
|
|
+ child: Text("退出登录"),
|
|
|
|
|
+ onPressed: () {
|
|
|
|
|
+ StoreProvider.of<AppState>(context)
|
|
|
|
|
+ .dispatch({"action": Actions.logout});
|
|
|
|
|
+ Toast.show(context, '退出成功', 1500, 'success');
|
|
|
|
|
+ Navigator.push(
|
|
|
|
|
+ context,
|
|
|
|
|
+ new MaterialPageRoute(
|
|
|
|
|
+ builder: (context) => new LoginFirst()));
|
|
|
|
|
+ }),
|
|
|
|
|
+ )
|
|
|
|
|
+ ],
|
|
|
|
|
+ )),
|
|
|
|
|
+ onWillPop: () {
|
|
|
|
|
+ Toast.hide();
|
|
|
|
|
+ Navigator.pop(context);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _settingItem(name, isNext) {
|
|
|
|
|
|
|
+ Widget _settingItem(userInfo, name, isNext) {
|
|
|
return Container(
|
|
return Container(
|
|
|
padding: EdgeInsets.only(left: 15, right: 15),
|
|
padding: EdgeInsets.only(left: 15, right: 15),
|
|
|
color: BG_COLOR,
|
|
color: BG_COLOR,
|
|
@@ -176,7 +167,7 @@ class SettingState extends State<Setting> {
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
fontSize: 14,
|
|
fontSize: 14,
|
|
|
fontWeight: FontWeight.w400)),
|
|
fontWeight: FontWeight.w400)),
|
|
|
- Expanded(flex: 1, child: _centerWidget(name)),
|
|
|
|
|
|
|
+ Expanded(flex: 1, child: _centerWidget(userInfo, name)),
|
|
|
Image.asset(
|
|
Image.asset(
|
|
|
'images/icon_inter.png',
|
|
'images/icon_inter.png',
|
|
|
width: name != '是否接受消息提示' && name != '版本号' ? 24 : 0,
|
|
width: name != '是否接受消息提示' && name != '版本号' ? 24 : 0,
|
|
@@ -193,30 +184,29 @@ class SettingState extends State<Setting> {
|
|
|
),
|
|
),
|
|
|
onTap: () {
|
|
onTap: () {
|
|
|
if (name == '头像') {
|
|
if (name == '头像') {
|
|
|
- getImage();
|
|
|
|
|
|
|
+ getImage(userInfo);
|
|
|
} else if (name == '昵称') {
|
|
} else if (name == '昵称') {
|
|
|
Navigator.push(
|
|
Navigator.push(
|
|
|
context,
|
|
context,
|
|
|
new CupertinoPageRoute(
|
|
new CupertinoPageRoute(
|
|
|
- builder: (context) => new ChangeUserInfo(title: '昵称')));
|
|
|
|
|
|
|
+ builder: (context) => new ChangeUserInfo(title: '昵称',val:userInfo.nickname)));
|
|
|
} else if (name == '性别') {
|
|
} else if (name == '性别') {
|
|
|
- showPicker(context);
|
|
|
|
|
|
|
+ showPicker(userInfo, context);
|
|
|
} else if (name == '生日') {
|
|
} else if (name == '生日') {
|
|
|
- showPickerDate(context);
|
|
|
|
|
|
|
+ showPickerDate(userInfo, context);
|
|
|
} else if (name == '手机') {
|
|
} else if (name == '手机') {
|
|
|
Navigator.push(
|
|
Navigator.push(
|
|
|
context,
|
|
context,
|
|
|
new CupertinoPageRoute(
|
|
new CupertinoPageRoute(
|
|
|
- builder: (context) => new ChangeUserInfo(title: '手机号')));
|
|
|
|
|
|
|
+ builder: (context) => new ChangeUserInfo(title: '手机号',val:userInfo.phone)));
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _centerWidget(name) {
|
|
|
|
|
|
|
+ Widget _centerWidget(userInfo, name) {
|
|
|
Widget _wiget;
|
|
Widget _wiget;
|
|
|
- print(name);
|
|
|
|
|
|
|
|
|
|
TextStyle mainText = TextStyle(
|
|
TextStyle mainText = TextStyle(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
@@ -236,21 +226,19 @@ class SettingState extends State<Setting> {
|
|
|
child: SizedBox(
|
|
child: SizedBox(
|
|
|
width: 36,
|
|
width: 36,
|
|
|
height: 36,
|
|
height: 36,
|
|
|
- child: CircleAvatar(
|
|
|
|
|
- backgroundImage: NetworkImage(
|
|
|
|
|
- userInfo.containsKey('icon') ? userInfo['icon'] : '')),
|
|
|
|
|
|
|
+ child: CircleAvatar(backgroundImage: NetworkImage(userInfo.icon)),
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
} else if (name == '昵称') {
|
|
} else if (name == '昵称') {
|
|
|
_wiget = Text(
|
|
_wiget = Text(
|
|
|
- userInfo.containsKey('nickname') ? userInfo['nickname'] : '',
|
|
|
|
|
|
|
+ userInfo.nickname,
|
|
|
style: mainText,
|
|
style: mainText,
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
);
|
|
);
|
|
|
} else if (name == '性别') {
|
|
} else if (name == '性别') {
|
|
|
- if (userInfo.containsKey('sex')) {
|
|
|
|
|
|
|
+ if (userInfo.sex != null) {
|
|
|
_wiget = Text(
|
|
_wiget = Text(
|
|
|
- userInfo['sex'],
|
|
|
|
|
|
|
+ userInfo.sex,
|
|
|
style: mainText,
|
|
style: mainText,
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
);
|
|
);
|
|
@@ -262,9 +250,9 @@ class SettingState extends State<Setting> {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
} else if (name == '生日') {
|
|
} else if (name == '生日') {
|
|
|
- if (userInfo.containsKey('birthday')) {
|
|
|
|
|
|
|
+ if (userInfo.birthday != null) {
|
|
|
_wiget = Text(
|
|
_wiget = Text(
|
|
|
- readTimestamp(userInfo['birthday']),
|
|
|
|
|
|
|
+ readTimestamp(userInfo.birthday),
|
|
|
style: mainText,
|
|
style: mainText,
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
);
|
|
);
|
|
@@ -276,9 +264,9 @@ class SettingState extends State<Setting> {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
} else if (name == '手机') {
|
|
} else if (name == '手机') {
|
|
|
- if (userInfo.containsKey('phone')) {
|
|
|
|
|
|
|
+ if (userInfo.phone != null) {
|
|
|
_wiget = Text(
|
|
_wiget = Text(
|
|
|
- userInfo['phone'],
|
|
|
|
|
|
|
+ userInfo.phone,
|
|
|
style: mainText,
|
|
style: mainText,
|
|
|
textAlign: TextAlign.right,
|
|
textAlign: TextAlign.right,
|
|
|
);
|
|
);
|
|
@@ -301,7 +289,7 @@ class SettingState extends State<Setting> {
|
|
|
),
|
|
),
|
|
|
));
|
|
));
|
|
|
} else if (name == '版本号') {
|
|
} else if (name == '版本号') {
|
|
|
- if (userInfo.containsKey('phone')) {
|
|
|
|
|
|
|
+ if (userInfo.phone != null) {
|
|
|
_wiget = Text(
|
|
_wiget = Text(
|
|
|
'V1.2.20',
|
|
'V1.2.20',
|
|
|
style: mainText,
|
|
style: mainText,
|
|
@@ -319,41 +307,30 @@ class SettingState extends State<Setting> {
|
|
|
return _wiget;
|
|
return _wiget;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void updateUserInfo(value, key) async {
|
|
|
|
|
- print(value);
|
|
|
|
|
- print(key);
|
|
|
|
|
- FormData formdata = new FormData.from({key: value, "id": userInfo['id']});
|
|
|
|
|
- print(formdata);
|
|
|
|
|
- final response = await Dio().post(domain + 'userInfo/update',
|
|
|
|
|
- data: formdata,
|
|
|
|
|
- options: Options(headers: {
|
|
|
|
|
- "token": StoreProvider.of<CountState>(context).state.usetoken
|
|
|
|
|
- }));
|
|
|
|
|
- print(response);
|
|
|
|
|
- final res = json.decode(response.toString());
|
|
|
|
|
- if (res['success']) {
|
|
|
|
|
- Toast.hide();
|
|
|
|
|
- getUserInfo(false);
|
|
|
|
|
|
|
+ void updateUserInfo(userInfo, value, key) async {
|
|
|
|
|
+ if (Toast.preToast == null) {
|
|
|
|
|
+ Toast.show(context, '加载中', -1, 'loading');
|
|
|
|
|
+ }
|
|
|
|
|
+ final Result res = await HttpManager.post('userInfo/update',
|
|
|
|
|
+ data: {"id": userInfo.id, key: value});
|
|
|
|
|
+ Toast.hide();
|
|
|
|
|
+ if (res.success) {
|
|
|
Toast.show(context, '修改成功', 1500, 'success');
|
|
Toast.show(context, '修改成功', 1500, 'success');
|
|
|
|
|
+ getUserInfo();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Toast.show(context, res.error, 1500, 'info');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void getUserInfo(isFreash) async {
|
|
|
|
|
- final response = await Dio().get(domain + 'userInfo/getUserInfo',
|
|
|
|
|
- options: Options(headers: {
|
|
|
|
|
- "token": StoreProvider.of<CountState>(context).state.usetoken
|
|
|
|
|
- }));
|
|
|
|
|
- final res = json.decode(response.toString());
|
|
|
|
|
- if (res['success']) {
|
|
|
|
|
- StoreProvider.of<CountState>(context)
|
|
|
|
|
- .dispatch({"action": Actions.updateUser, "val": res['data']});
|
|
|
|
|
- setState(() {
|
|
|
|
|
- userInfo = res['data'];
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ void getUserInfo() async {
|
|
|
|
|
+ Result res = await HttpManager.get("userInfo/getUserInfo");
|
|
|
|
|
+ if (res.success) {
|
|
|
|
|
+ StoreProvider.of<AppState>(context)
|
|
|
|
|
+ .dispatch({"action": Actions.updateUser, "user": res.data});
|
|
|
|
|
+ } else {}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- showPicker(BuildContext context) {
|
|
|
|
|
|
|
+ showPicker(userInfo, BuildContext context) {
|
|
|
String PickerData = '''["男","女"]''';
|
|
String PickerData = '''["男","女"]''';
|
|
|
new Picker(
|
|
new Picker(
|
|
|
confirmText: '确定',
|
|
confirmText: '确定',
|
|
@@ -366,11 +343,11 @@ class SettingState extends State<Setting> {
|
|
|
onConfirm: (Picker picker, List value) {
|
|
onConfirm: (Picker picker, List value) {
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
updateUserInfo(
|
|
updateUserInfo(
|
|
|
- picker.getSelectedValues()[0].toString().trim(), 'sex');
|
|
|
|
|
- }).showModal(this.context);
|
|
|
|
|
|
|
+ userInfo, picker.getSelectedValues()[0].toString().trim(), 'sex');
|
|
|
|
|
+ }).showModal(context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- showPickerDate(BuildContext context) {
|
|
|
|
|
|
|
+ showPickerDate(userInfo, BuildContext context) {
|
|
|
new Picker(
|
|
new Picker(
|
|
|
hideHeader: true,
|
|
hideHeader: true,
|
|
|
confirmText: '确定',
|
|
confirmText: '确定',
|
|
@@ -391,6 +368,7 @@ class SettingState extends State<Setting> {
|
|
|
}
|
|
}
|
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
Toast.show(context, '加载中', -1, 'loading');
|
|
|
updateUserInfo(
|
|
updateUserInfo(
|
|
|
|
|
+ userInfo,
|
|
|
DateTime.parse(picker.adapter.toString()).millisecondsSinceEpoch,
|
|
DateTime.parse(picker.adapter.toString()).millisecondsSinceEpoch,
|
|
|
'birthday');
|
|
'birthday');
|
|
|
}).showDialog(context);
|
|
}).showDialog(context);
|