多语言后端数据
This commit is contained in:
@@ -85,50 +85,7 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
||||
left: 0.rpx,
|
||||
child: returnIconButtomNew(),
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 10.rpx,
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
stringToColor("FCFCFC"),
|
||||
stringToColor("CEECE3"),
|
||||
],
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0.rpx, 16.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'保存'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: stringToColor("#011D33"),
|
||||
letterSpacing: 0.0,
|
||||
fontSize: AppConstants().normal_text_fontSize),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -143,174 +100,258 @@ class _UpdateUserPageState extends State<EditUserPage> {
|
||||
decoration: BoxDecoration(),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
60.rpx, 0.rpx, 60.rpx, 0.rpx),
|
||||
30.rpx, 0.rpx, 30.rpx, 0.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: MediaQuery.sizeOf(context).width * 0.213,
|
||||
height: MediaQuery.sizeOf(context).height * 0.098,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 160.rpx,
|
||||
minHeight: 160.rpx,
|
||||
Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 76.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width:
|
||||
MediaQuery.sizeOf(context).width * 0.213,
|
||||
height:
|
||||
MediaQuery.sizeOf(context).height * 0.098,
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 160.rpx,
|
||||
minHeight: 160.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() {
|
||||
return getImageWidget(context);
|
||||
})),
|
||||
),
|
||||
decoration: BoxDecoration(),
|
||||
child: Obx(() {
|
||||
return getImageWidget(context);
|
||||
})),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc2,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 44.rpx, 0.rpx, 44.rpx),
|
||||
borderRadius: 0,
|
||||
onTap: () async {
|
||||
edm.EasyDartModule.logger
|
||||
.info("${userInfoController.model.user!}点击上传头像");
|
||||
DailyLogUtils.writeLog(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.uploadImg();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Text(
|
||||
'点击更换头像'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#85F5FF"),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 79.rpx, 0.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(0, 0),
|
||||
child: TextFormField(
|
||||
initialValue: userInfoController
|
||||
.model.user!.nick_name,
|
||||
onChanged: (value) {
|
||||
userInfoController.model.user!
|
||||
.tmpNickName = value;
|
||||
},
|
||||
autofocus: false,
|
||||
obscureText: false,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
labelStyle: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
hintText: '未命名'.tr,
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0x00000000),
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
filled: false,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 38.rpx), // 保持上下间距
|
||||
child: Center(
|
||||
child: ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc2,
|
||||
borderRadius: 8.rpx, // 可选,点击反馈更明显
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 12.rpx,
|
||||
vertical: 12.rpx), // 控制点击热区大小
|
||||
onTap: () async {
|
||||
edm.EasyDartModule.logger.info(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
DailyLogUtils.writeLog(
|
||||
"${userInfoController.model.user!}点击上传头像");
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.uploadImg();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code ==
|
||||
HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'点击更换头像'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: stringToColor("#85F5FF"),
|
||||
),
|
||||
].divide(SizedBox(width: 27.rpx)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 79.rpx, 30.rpx, 0.rpx),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
TextFormField(
|
||||
initialValue: userInfoController
|
||||
.model.user!.nick_name,
|
||||
onChanged: (value) {
|
||||
userInfoController.model.user!
|
||||
.tmpNickName = value;
|
||||
},
|
||||
maxLength:
|
||||
AppConstants().text_length,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
textAlignVertical:
|
||||
TextAlignVertical.center,
|
||||
buildCounter: (_,
|
||||
{int? currentLength,
|
||||
bool? isFocused,
|
||||
int? maxLength}) =>
|
||||
null, // 禁用默认计数器
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(
|
||||
vertical: 30.rpx),
|
||||
isDense: true,
|
||||
hintText: '未命名'.tr,
|
||||
hintStyle: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
enabledBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
Colors.transparent,
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
Colors.transparent,
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
errorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
focusedErrorBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
width: 1.rpx),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8.rpx),
|
||||
),
|
||||
filled: false,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
|
||||
// 自定义右下角计数器
|
||||
Positioned(
|
||||
bottom: 4.rpx,
|
||||
right: 8.rpx,
|
||||
child: Obx(() {
|
||||
final text =
|
||||
userInfoController
|
||||
.model
|
||||
.user!
|
||||
.tmpNickName ??
|
||||
'';
|
||||
return Text(
|
||||
'${text.length} / ${AppConstants().text_length}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.rpx,
|
||||
color: Colors.grey,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
)),
|
||||
].divide(SizedBox(width: 27.rpx)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 0.rpx, right: 0.rpx, bottom: 85.rpx),
|
||||
child: CustomCard(
|
||||
borderRadius: 10.rpx,
|
||||
onTap: () async {
|
||||
ApiResponse apiResponse =
|
||||
await userInfoController.updateData();
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code == HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc2
|
||||
: themeController.currentColor.sc9,
|
||||
);
|
||||
if (apiResponse.code == HttpStatusCodes.ok) {
|
||||
userInfoController.model.user!.tmpHead = null;
|
||||
userInfoController.model.user!.tmpNickName = null;
|
||||
await userInfoController.getUserInfo();
|
||||
userInfoController.updateAll();
|
||||
Get.back();
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
stringToColor("FCFCFC"),
|
||||
stringToColor("CEECE3"),
|
||||
],
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
child: Container(
|
||||
// width: 100.rpx,
|
||||
height: 90.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0.rpx, 16.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'保存'.tr,
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: stringToColor("#011D33"),
|
||||
letterSpacing: 0.0,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user