|
|
@@ -83,11 +83,23 @@ class _MineDetailContainer extends StatefulWidget { |
|
|
|
class _MineDetailContainerState extends State<_MineDetailContainer> { |
|
|
|
MineDetailBloc _bloc; |
|
|
|
TextEditingController _nickController = TextEditingController(); |
|
|
|
FocusNode nickNameFocusNode; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
_bloc = BlocProvider.of<MineDetailBloc>(context); |
|
|
|
_bloc.loadData(); |
|
|
|
nickNameFocusNode = FocusNode(); |
|
|
|
nickNameFocusNode.addListener(() { |
|
|
|
if (!nickNameFocusNode.hasFocus) { |
|
|
|
FocusScope.of(context).requestFocus(new FocusNode()); |
|
|
|
if (_nickController.text == null || _nickController.text == '') { |
|
|
|
Fluttertoast.showToast(msg: '昵称不为空'); |
|
|
|
return; |
|
|
|
} |
|
|
|
_bloc.updateUser(nickname: _nickController.text); |
|
|
|
} |
|
|
|
}); |
|
|
|
super.initState(); |
|
|
|
} |
|
|
|
|
|
|
@@ -117,19 +129,11 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { |
|
|
|
_selectSex(); |
|
|
|
}), |
|
|
|
_createLine(), |
|
|
|
_createItem( |
|
|
|
'出生日期', |
|
|
|
birthday > 0 |
|
|
|
? DateFormat('yyyy-MM-dd').format(DateTime.fromMillisecondsSinceEpoch(birthday * 1000)) |
|
|
|
: user?.birthday ?? '', onTap: () { |
|
|
|
_createItem('出生日期', birthday > 0 ? DateFormat('yyyy-MM-dd').format(DateTime.fromMillisecondsSinceEpoch(birthday * 1000)) : user?.birthday ?? '', onTap: () { |
|
|
|
_selectBrithday(); |
|
|
|
}), |
|
|
|
_createLine(), |
|
|
|
_createItem( |
|
|
|
'注册时间', |
|
|
|
registTime > 0 |
|
|
|
? DateFormat('yyyy-MM-dd').format(DateTime.fromMillisecondsSinceEpoch(registTime * 1000)) |
|
|
|
: user?.registerTime ?? ''), |
|
|
|
_createItem('注册时间', registTime > 0 ? DateFormat('yyyy-MM-dd').format(DateTime.fromMillisecondsSinceEpoch(registTime * 1000)) : user?.registerTime ?? ''), |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 8), |
|
|
|
child: _createItem('填写微信号', user?.is_upload_wx == '1' ? '已上传' : '未上传微信号与二维码', onTap: () { |
|
|
@@ -234,17 +238,18 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { |
|
|
|
textInputAction: TextInputAction.done, |
|
|
|
controller: controller, |
|
|
|
textAlign: TextAlign.right, |
|
|
|
focusNode: nickNameFocusNode, |
|
|
|
placeholder: '输入昵称', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 13, |
|
|
|
color: Color(0xff999999), |
|
|
|
), |
|
|
|
onSubmitted: (value) { |
|
|
|
if (value == null || value == '') { |
|
|
|
Fluttertoast.showToast(msg: '昵称不为空'); |
|
|
|
return; |
|
|
|
} |
|
|
|
_bloc.updateUser(nickname: value); |
|
|
|
// if (value == null || value == '') { |
|
|
|
// Fluttertoast.showToast(msg: '昵称不为空'); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// _bloc.updateUser(nickname: value); |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
@@ -317,7 +322,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { |
|
|
|
return; |
|
|
|
} |
|
|
|
Loading.show(context); |
|
|
|
File resultFile = await EncodeUtil.compressImage(context,file:cropperFile,size: 800); |
|
|
|
File resultFile = await EncodeUtil.compressImage(context, file: cropperFile, size: 800); |
|
|
|
|
|
|
|
_bloc.uploadAvatar(resultFile); |
|
|
|
} |
|
|
|