提交 33ce5c6e authored 作者: yueweilu's avatar yueweilu

修正

上级 d383199f
......@@ -12,128 +12,121 @@ class UserInfoPage extends StatefulWidget {
class _UserInfoPageState extends State<UserInfoPage> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<UserInfoController>(
init: UserInfoController(widget.userInfo),
builder: (controller) =>
Scaffold(
appBar: AppBar(
title: const Text('个人信息'),
centerTitle: true,
),
body: Container(
margin: const EdgeInsets.symmetric(
horizontal: AppTheme.margin, vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: const Offset(3, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
],
return GetBuilder<UserInfoController>(
init: UserInfoController(widget.userInfo),
builder: (controller) =>
Scaffold(
appBar: AppBar(
title: const Text('个人信息'),
centerTitle: true,
),
body: Container(
margin: const EdgeInsets.symmetric(
horizontal: AppTheme.margin, vertical: AppTheme.margin),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Colors.white,
boxShadow: [
BoxShadow(
color: const Color(0xFFC7C7C7).withOpacity(0.5),
offset: const Offset(3, 0),
blurRadius: 10.w,
spreadRadius: 0.w,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
/// 头像
Container(
height: 52,
padding: const EdgeInsets.only(left: 18, right: 15),
child: GestureDetector(
onTap: () async {
final assets = await AssetsPicker.image(
context: context,
source: ImageSource.gallery,
maxWidth: 512,
maxHeight: 512,
);
controller.upload(path: assets!.path);
},
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
/// 头像
Container(
height: 52,
padding: const EdgeInsets.only(left: 18, right: 15),
child: GestureDetector(
onTap: () async {
final assets = await AssetsPicker.image(
context: context,
source: ImageSource.gallery,
maxWidth: 512,
maxHeight: 512,
);
controller.upload(path: assets!.path);
},
child: Container(
color: Colors.transparent,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'头像',
style: TextStyle(
color: Colours.c3,
fontSize: 14,
height: 1.6),
),
Row(
children: [
const Text(
'头像',
style: TextStyle(
color: Colours.c3,
fontSize: 14,
height: 1.6),
Container(
width: 33.w,
height: 33.w,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.cyan,
),
child: CustomImage.network(
url: controller.userInfo.headImg ?? '',
radius: 16.5,
),
),
Row(
children: [
Container(
width: 33.w,
height: 33.w,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Colors.cyan,
),
child: CustomImage.network(
url: controller.userInfo.headImg ?? '',
radius: 16.5,
),
),
Gaps.hGaps10,
SizedBox(
width: 5,
height: 8,
child: Image.asset(
'assets/images/right_arrow.png'),
)
],
Gaps.hGaps10,
SizedBox(
width: 5,
height: 8,
child: Image.asset(
'assets/images/right_arrow.png'),
)
],
),
),
)
],
),
),
Container(
color: Colours.cLine,
margin: const EdgeInsets.symmetric(horizontal: 15),
height: 1,
),
GestureDetector(
onTap: () {
context.pushNamed(Routes.nike, extra: controller.userInfo);
},
child: _buildItem(
'昵称',
widget.userInfo.name ?? '',
)),
Container(
color: Colours.cLine,
margin: const EdgeInsets.symmetric(horizontal: 15),
height: 1,
),
GestureDetector(
onTap: () {
context.pushNamed(
Routes.gender, extra: controller.userInfo);
},
child: _buildItem(
'性别',
getGender(widget.userInfo.sex)
// widget.userInfo.sex == 1 ? '男' : '女',
),
),
Container(
color: Colours.cLine,
margin: const EdgeInsets.symmetric(horizontal: 15),
height: 1,
),
GestureDetector(
onTap: () {
context.pushNamed(Routes.nike, extra: controller.userInfo);
},
child: _buildItem(
'昵称',
widget.userInfo.name ?? '',
)),
],
),
),
)),)
,
);
Container(
color: Colours.cLine,
margin: const EdgeInsets.symmetric(horizontal: 15),
height: 1,
),
GestureDetector(
onTap: () {
context.pushNamed(
Routes.gender, extra: controller.userInfo);
},
child: _buildItem(
'性别',
getGender(widget.userInfo.sex)
// widget.userInfo.sex == 1 ? '男' : '女',
)),
],
),
),
)),);
}
getGender(num? sex) {
......
......@@ -6,7 +6,7 @@ class UserNickController extends GetxController {
UserNickController(this.userInfo);
/// 修改用用户信息
void _changeInfo(String nick) async {
void changeInfo(String nick) async {
final result = await MineAPI.changeInfo(name: nick);
if (result) {
Toast.show('修改成功');
......
......@@ -10,7 +10,8 @@ class UserNickPage extends StatefulWidget {
}
class _UserNickPageState extends State<UserNickPage> {
TextEditingController _textFieldController = TextEditingController();
final TextEditingController _textFieldController = TextEditingController();
final FocusNode _focusNode = FocusNode();
@override
void initState() {
......@@ -32,24 +33,25 @@ class _UserNickPageState extends State<UserNickPage> {
width: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: AppTheme.primary, width: 1)),
border: Border.all(color: Colours.c3, width: 0.5)),
child: Center(
child: GestureDetector(
onTap: () {
// print("保存昵称");
controller._changeInfo(_textFieldController.text);
controller.changeInfo(_textFieldController.text);
_focusNode.unfocus();
},
child: const Text(
'保存',
style: TextStyle(
fontSize: 12, color: AppTheme.primary),
fontSize: 12, color: Colours.c3),
)),
),
)
],
),
body: Container(
margin: const EdgeInsets.symmetric(horizontal: AppTheme.margin),
margin: const EdgeInsets.only(left: AppTheme.margin,right: AppTheme.margin,top: AppTheme.margin),
height: 42,
decoration: BoxDecoration(boxShadow: [
BoxShadow(
......@@ -86,6 +88,7 @@ class _UserNickPageState extends State<UserNickPage> {
focusedBorder: InputBorder.none,
suffixIconConstraints: BoxConstraints.tightFor(
height: 15, width: 15)),
focusNode: _focusNode,
),
),
GestureDetector(
......@@ -95,7 +98,7 @@ class _UserNickPageState extends State<UserNickPage> {
print('Image Clicked!');
},
child: Image(
image: AssetImage('assets/images/del.png'),
image: const AssetImage('assets/images/del.png'),
height: 15.w,
width: 15.w,
),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论