提交 d8d34c31 authored 作者: maodou's avatar maodou

1:我的页面和个人信息页面超长昵称显示问题

上级 448adb05
...@@ -44,7 +44,6 @@ class _MinePageState extends State<MinePage> { ...@@ -44,7 +44,6 @@ class _MinePageState extends State<MinePage> {
GestureDetector( GestureDetector(
onTap: () async{ onTap: () async{
final result = await context.pushNamed(Routes.msgs); final result = await context.pushNamed(Routes.msgs);
print('---------------------------------1111$result'); print('---------------------------------1111$result');
if (result == true){ if (result == true){
controller.getNums(); controller.getNums();
......
...@@ -2,23 +2,18 @@ part of mine; ...@@ -2,23 +2,18 @@ part of mine;
/// 用户信息 /// 用户信息
class BuildUser extends StatelessWidget { class BuildUser extends StatelessWidget {
final void Function()? onTap; final void Function()? onTap;
final UserInfoModel userInfo; final UserInfoModel userInfo;
const BuildUser ({ const BuildUser({super.key, this.onTap, required this.userInfo});
super.key,
this.onTap,
required this.userInfo
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap:onTap, onTap: onTap,
child: Container( child: Container(
margin: EdgeInsets.only(left: 10.w,right: 10.w), margin: EdgeInsets.only(left: 10.w, right: 10.w),
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
...@@ -33,7 +28,10 @@ class BuildUser extends StatelessWidget { ...@@ -33,7 +28,10 @@ class BuildUser extends StatelessWidget {
color: Colors.cyan, color: Colors.cyan,
), ),
// color: Colors.cyan, // color: Colors.cyan,
child: CustomImage.network(url: userInfo.headImg??'',radius: 22.5.w,), child: CustomImage.network(
url: userInfo.headImg ?? '',
radius: 22.5.w,
),
), ),
Gaps.hGaps10, Gaps.hGaps10,
Column( Column(
...@@ -42,22 +40,34 @@ class BuildUser extends StatelessWidget { ...@@ -42,22 +40,34 @@ class BuildUser extends StatelessWidget {
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text(userInfo.name??'',style: TextStyle( ConstrainedBox(
color: Colours.c3, constraints: BoxConstraints(
fontSize: 15.w, maxWidth: 150.w, // 设置最大宽度
fontWeight: Fonts.medium, ),
height: 1.6.w child: Text(
),), userInfo.name ?? '',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colours.c3,
fontSize: 15.w,
fontWeight: Fonts.medium,
height: 1.6.w),
),
),
Gaps.hGaps20, Gaps.hGaps20,
Stack( Stack(
children: [ children: [
Container( Container(
padding: EdgeInsets.only(right:8.w,left: 8.w), padding: EdgeInsets.only(right: 8.w, left: 8.w),
height: 20.w, height: 20.w,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(21.w), borderRadius: BorderRadius.circular(21.w),
gradient: LinearGradient( gradient: LinearGradient(
colors: [AppTheme.primary.withOpacity(0.03),AppTheme.primary.withOpacity(0.1)] , // 不可点击时的颜色,透明度为0.7 colors: [
AppTheme.primary.withOpacity(0.03),
AppTheme.primary.withOpacity(0.1)
], // 不可点击时的颜色,透明度为0.7
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight, end: Alignment.centerRight,
), ),
...@@ -68,26 +78,32 @@ class BuildUser extends StatelessWidget { ...@@ -68,26 +78,32 @@ class BuildUser extends StatelessWidget {
width: 16.w, width: 16.w,
height: 17.w, height: 17.w,
), ),
Text(userInfo.gradeName??'',style: TextStyle(fontSize: 11.w,color: AppTheme.primary),) Text(
userInfo.gradeName ?? '',
style: TextStyle(
fontSize: 11.w,
color: AppTheme.primary),
)
], ],
), ),
), ),
Positioned( Positioned(
left: 8, left: 8,
child: SizedBox( child: SizedBox(
width: 16.w, height:17.w, width: 16.w,
child: Image.asset('assets/images/grade.png') height: 17.w,
), child:
Image.asset('assets/images/grade.png')),
) )
], ],
) )
], ],
), ),
Gaps.vGaps5, Gaps.vGaps5,
Text(userInfo.phone??'',style: TextStyle( Text(
fontSize: 12.w, userInfo.phone ?? '',
color: Colours.c6 style: TextStyle(fontSize: 12.w, color: Colours.c6),
),) )
], ],
), ),
Gaps.hGaps20, Gaps.hGaps20,
......
...@@ -287,15 +287,18 @@ class _UserInfoPageState extends State<UserInfoPage> { ...@@ -287,15 +287,18 @@ class _UserInfoPageState extends State<UserInfoPage> {
color: Colours.c3, color: Colours.c3,
), ),
), ),
SizedBox(width: 10.w,),
Row( Row(
children: [ children: [
Text( Container(width: 240.w, alignment: Alignment.centerRight,
child: Text(
value, value,
overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 14.w, fontSize: 14.w,
color: Colours.c9, color: Colours.c9,
), ),
), ),),
Gaps.hGaps10, Gaps.hGaps10,
SizedBox( SizedBox(
width: 5.w, width: 5.w,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论