提交 feb8d22d authored 作者: yueweilu's avatar yueweilu

修改头像后 回到我的界面请求我的信息

上级 f5087672
...@@ -67,8 +67,11 @@ class _MinePageState extends State<MinePage> { ...@@ -67,8 +67,11 @@ class _MinePageState extends State<MinePage> {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
BuildUser(userInfo:controller.userInfo,onTap: (){ BuildUser(userInfo:controller.userInfo,onTap: () async{
context.pushNamed(Routes.userInfo,extra: controller.userInfo); final result = await context.pushNamed(Routes.userInfo,extra: controller.userInfo);
if (result == true){
controller.getInfo();
}
},), },),
Gaps.vGaps10, Gaps.vGaps10,
BuildRead(items: controller.reads,onTap: (ReadModel model) async{ BuildRead(items: controller.reads,onTap: (ReadModel model) async{
......
...@@ -14,90 +14,96 @@ class UserInfoPage extends StatefulWidget { ...@@ -14,90 +14,96 @@ 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 GetBuilder<UserInfoController>( return WillPopScope(
init: UserInfoController(widget.userInfo), onWillPop: () async {
builder: (controller) =>Scaffold( context.pop(true);
appBar: AppBar( return false;
title: const Text('个人信息'), },
centerTitle: true, child: GetBuilder<UserInfoController>(
), init: UserInfoController(widget.userInfo),
body: Container( builder: (controller) =>Scaffold(
margin: const EdgeInsets.symmetric(horizontal: AppTheme.margin,vertical: AppTheme.margin), appBar: AppBar(
decoration: BoxDecoration( title: const Text('个人信息'),
borderRadius: BorderRadius.circular(8), centerTitle: true,
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( body: Container(
borderRadius: BorderRadius.circular(8), margin: const EdgeInsets.symmetric(horizontal: AppTheme.margin,vertical: AppTheme.margin),
child: Column( decoration: BoxDecoration(
mainAxisSize: MainAxisSize.min, borderRadius: BorderRadius.circular(8),
children: [ color: Colors.white,
/// 头像 boxShadow: [
Container( BoxShadow(
height: 52, color: const Color(0xFFC7C7C7).withOpacity(0.5),
padding: const EdgeInsets.only(left: 18,right: 15), offset: const Offset(3, 0),
child: GestureDetector( blurRadius: 10.w,
onTap: () async { spreadRadius: 0.w,
final assets = await AssetsPicker.image( ),
context: context, ],
source: ImageSource.gallery, ),
maxWidth: 512, child: ClipRRect(
maxHeight: 512, borderRadius: BorderRadius.circular(8),
); child: Column(
controller.upload(path: assets!.path); 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( child: Container(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
const Text('头像',style: TextStyle(color: Colours.c3,fontSize: 14,height: 1.6),), const Text('头像',style: TextStyle(color: Colours.c3,fontSize: 14,height: 1.6),),
Row( Row(
children: [ children: [
Container( Container(
width: 33.w, width: 33.w,
height: 33.w, height: 33.w,
decoration: const BoxDecoration( decoration: const BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: Colors.cyan, color: Colors.cyan,
),
child: CustomImage.network(url: controller.userInfo.headImg??'',radius: 16.5,),
), ),
child: CustomImage.network(url: controller.userInfo.headImg??'',radius: 16.5,), Gaps.hGaps10,
), SizedBox(
Gaps.hGaps10, width: 5,
SizedBox( height: 8,
width: 5, child: Image.asset('assets/images/right_arrow.png'),
height: 8, )
child: Image.asset('assets/images/right_arrow.png'), ],
) )
], ],
) ),
],
), ),
), ),
), ),
), Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,), GestureDetector(
GestureDetector( onTap: (){
onTap: (){ context.pushNamed(Routes.nike);
context.pushNamed(Routes.nike); },
}, child: _buildItem('昵称', widget.userInfo.name??'', )
child: _buildItem('昵称', widget.userInfo.name??'', ) ),
), Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,), _buildItem('性别', widget.userInfo.sex ==1?'男':'女',),
_buildItem('性别', widget.userInfo.sex ==1?'男':'女',), ],
], ),
), ),
), )
) ),
), ),
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论