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

修正

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