更新部分显示样式

This commit is contained in:
wyf
2025-12-09 15:47:05 +08:00
parent 5e63f2dfdc
commit e7c51bea52
15 changed files with 223 additions and 122 deletions

View File

@@ -418,7 +418,9 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 22.rpx)),
SizedBox(width: 22.rpx),
getNowInfoByType('phone'),
],
),
Row(
mainAxisSize: MainAxisSize.max,
@@ -427,9 +429,8 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
getTextByUserInfo('phone'),
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),
color: themeController
.currentColor.sc2,
color: getColorByUserInfo(
'phone'),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -485,7 +486,9 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 22.rpx)),
SizedBox(width: 22.rpx),
getNowInfoByType('email'),
],
),
Row(
mainAxisSize: MainAxisSize.max,
@@ -495,8 +498,8 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),
color: themeController
.currentColor.sc2,
color: getColorByUserInfo(
'email'),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -589,13 +592,8 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),
color: getTextByUserInfo(
'wechat') ==
"解绑".tr
? themeController
.currentColor.sc4
: themeController
.currentColor.sc2,
color: getColorByUserInfo(
'wechat'),
fontSize: 26.rpx,
letterSpacing: 0.0,
),
@@ -621,7 +619,6 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
),
),
),
],
),
),
@@ -669,25 +666,95 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
}
if (type == "phone") {
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
return "更换".tr;
return "去绑定".tr;
} else {
return "换绑".tr;
}
}
if (type == "email") {
if (userInfo.email == null || userInfo.email!.isEmpty) {
return "绑定".tr;
return "绑定".tr;
} else {
return "换绑".tr;
}
}
if (type == "wechat") {
if (userInfo.bindWx == null || userInfo.bindWx == false) {
return "绑定".tr;
return "绑定".tr;
} else {
return "解绑".tr;
}
}
return "";
}
Color getColorByUserInfo(String type) {
final text = getTextByUserInfo(type);
// 去绑定 = 未绑定
return text == "去绑定".tr
? themeController.currentColor.sc4
: themeController.currentColor.sc2;
}
getNowInfoByType(String type) {
UserInfoController userInfoController = Get.find();
UserModel userInfo = userInfoController.model.user!;
if (type == "phone") {
if (userInfo.phone == null || userInfo.phone!.isEmpty) {
return Text(
"(" + "暂未绑定".tr + ")",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
),
);
} else {
return Text(
"(" + "${getHidePhone()}" + ")",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
),
);
}
}
if (type == "email") {
if (userInfo.email == null || userInfo.email!.isEmpty) {
return Text(
"(" + "暂未绑定".tr + ")",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
),
);
} else {
return Text(
"(" + "${getHideEmail()}" + ")",
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
),
);
}
}
return Container();
}
getHidePhone() {
UserModel userModel = userInfoController.model.user!;
if (userModel.phone == null || userModel.phone == "") {
return "暂无".tr;
}
return "${userModel.phone!.substring(0, 3)}****${userModel.phone!.substring(7, 11)}";
}
getHideEmail() {
UserModel userModel = userInfoController.model.user!;
if (userModel.email == null || userModel.email == "") {
return "暂无".tr;
}
return userModel.email!
.replaceRange(3, userModel.email!.length - 3, "****");
}
}