|
|
@ -63,7 +63,6 @@ class ProfileView extends GetView<ProfileController> { |
|
|
body: ListView( |
|
|
body: ListView( |
|
|
children: [ |
|
|
children: [ |
|
|
SizedBox(height: 12.h), |
|
|
SizedBox(height: 12.h), |
|
|
|
|
|
|
|
|
const Divider(), |
|
|
const Divider(), |
|
|
_buildMenuItem( |
|
|
_buildMenuItem( |
|
|
title: '关于'.tr, |
|
|
title: '关于'.tr, |
|
|
@ -72,7 +71,6 @@ class ProfileView extends GetView<ProfileController> { |
|
|
// TODO: 实现关于页面 |
|
|
// TODO: 实现关于页面 |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
const Divider(), |
|
|
const Divider(), |
|
|
_buildMenuItem( |
|
|
_buildMenuItem( |
|
|
title: '火山语音合成测试'.tr, |
|
|
title: '火山语音合成测试'.tr, |
|
|
@ -82,8 +80,6 @@ class ProfileView extends GetView<ProfileController> { |
|
|
Get.toNamed(Routes.TTS_TEST); |
|
|
Get.toNamed(Routes.TTS_TEST); |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Divider(), |
|
|
const Divider(), |
|
|
_buildMenuItem( |
|
|
_buildMenuItem( |
|
|
title: '火山语音识别测试'.tr, |
|
|
title: '火山语音识别测试'.tr, |
|
|
@ -102,7 +98,7 @@ class ProfileView extends GetView<ProfileController> { |
|
|
Get.toNamed(Routes.AZURE_ASR_TEST); |
|
|
Get.toNamed(Routes.AZURE_ASR_TEST); |
|
|
}, |
|
|
}, |
|
|
), |
|
|
), |
|
|
const Divider(), |
|
|
const Divider(), |
|
|
_buildMenuItem( |
|
|
_buildMenuItem( |
|
|
title: 'Azure语音合成测试'.tr, |
|
|
title: 'Azure语音合成测试'.tr, |
|
|
icon: Icons.record_voice_over, |
|
|
icon: Icons.record_voice_over, |
|
|
@ -134,8 +130,7 @@ class ProfileView extends GetView<ProfileController> { |
|
|
bottomNavigationBar: const CommonBottomNav(currentIndex: 2), |
|
|
bottomNavigationBar: const CommonBottomNav(currentIndex: 2), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// EditProfileView: 编辑个人资料页面 |
|
|
// EditProfileView: 编辑个人资料页面 |
|
|
class EditProfileView extends GetView<ProfileController> { |
|
|
class EditProfileView extends GetView<ProfileController> { |
|
|
@ -144,29 +139,45 @@ class EditProfileView extends GetView<ProfileController> { |
|
|
@override |
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark; |
|
|
final nameController = TextEditingController(text: controller.userInfo.value.name); |
|
|
final nameController = |
|
|
|
|
|
TextEditingController(text: controller.userInfo.value.name); |
|
|
|
|
|
|
|
|
return Scaffold( |
|
|
return Scaffold( |
|
|
appBar: AppBar( |
|
|
appBar: AppBar( |
|
|
title: const Text('个人资料'), |
|
|
automaticallyImplyLeading: false, |
|
|
actions: [ |
|
|
centerTitle: true, |
|
|
TextButton( |
|
|
elevation: 0, |
|
|
onPressed: () { |
|
|
backgroundColor: isDarkMode ? Colors.black : Colors.white, |
|
|
// 保存用户名 |
|
|
title: Text( |
|
|
controller.updateUserName(nameController.text); |
|
|
'编辑个人资料', |
|
|
// 返回上一级页面 |
|
|
style: TextStyle( |
|
|
Get.back(); |
|
|
fontSize: 17.sp, |
|
|
}, |
|
|
fontWeight: FontWeight.w600, |
|
|
child: Text( |
|
|
color: isDarkMode ? Colors.white : Colors.black, |
|
|
'保存', |
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
color: isDarkMode ? Colors.blue[300] : Colors.blue, |
|
|
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
), |
|
|
], |
|
|
), |
|
|
|
|
|
// actions: [ |
|
|
|
|
|
// TextButton( |
|
|
|
|
|
// onPressed: () { |
|
|
|
|
|
// // 保存用户名 |
|
|
|
|
|
// controller.updateUserName(nameController.text); |
|
|
|
|
|
// // 返回上一级页面 |
|
|
|
|
|
// Get.back(); |
|
|
|
|
|
// }, |
|
|
|
|
|
// style: TextButton.styleFrom( |
|
|
|
|
|
// foregroundColor: Colors.blue, // 确保按钮文字颜色 |
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
|
|
|
|
// ), |
|
|
|
|
|
// child: Text( |
|
|
|
|
|
// '保 存', |
|
|
|
|
|
// style: TextStyle( |
|
|
|
|
|
// fontSize: 16.sp, |
|
|
|
|
|
// color: isDarkMode ? Colors.blue[300] : Colors.blue, |
|
|
|
|
|
// fontWeight: FontWeight.w500, |
|
|
|
|
|
// ), |
|
|
|
|
|
// ), |
|
|
|
|
|
// ), |
|
|
|
|
|
// ], |
|
|
), |
|
|
), |
|
|
body: Padding( |
|
|
body: Padding( |
|
|
padding: EdgeInsets.all(16.w), |
|
|
padding: EdgeInsets.all(16.w), |
|
|
@ -175,22 +186,40 @@ class EditProfileView extends GetView<ProfileController> { |
|
|
// 头像编辑 |
|
|
// 头像编辑 |
|
|
Center( |
|
|
Center( |
|
|
child: GestureDetector( |
|
|
child: GestureDetector( |
|
|
onTap: () => controller.updateUserAvatar(), |
|
|
onTap: () => controller.updateUserAvatar(), |
|
|
child: Obx(() => CircleAvatar( |
|
|
child: Stack( |
|
|
radius: 50.r, |
|
|
children: [ |
|
|
backgroundImage: controller.userInfo.value.avatar.isNotEmpty |
|
|
Obx(() => CircleAvatar( |
|
|
? FileImage(File(controller.userInfo.value.avatar)) |
|
|
radius: 50.r, |
|
|
: null, |
|
|
backgroundImage: |
|
|
child: controller.userInfo.value.avatar.isEmpty |
|
|
controller.userInfo.value.avatar.isNotEmpty |
|
|
? Icon(Icons.person, size: 50.r) |
|
|
? FileImage( |
|
|
: null, |
|
|
File(controller.userInfo.value.avatar)) |
|
|
// onBackgroundImageError: hasAvatar |
|
|
: null, |
|
|
// ? (_, __) {} |
|
|
child: controller.userInfo.value.avatar.isEmpty |
|
|
// : null, |
|
|
? Icon(Icons.person, size: 50.r) |
|
|
)), |
|
|
: null, |
|
|
), |
|
|
)), |
|
|
|
|
|
Positioned( |
|
|
|
|
|
right: 0, |
|
|
|
|
|
bottom: 0, |
|
|
|
|
|
child: Container( |
|
|
|
|
|
padding: EdgeInsets.all(4.w), |
|
|
|
|
|
decoration: const BoxDecoration( |
|
|
|
|
|
color: Colors.blue, |
|
|
|
|
|
shape: BoxShape.circle, |
|
|
|
|
|
), |
|
|
|
|
|
child: Icon( |
|
|
|
|
|
Icons.camera_alt, |
|
|
|
|
|
size: 20.w, |
|
|
|
|
|
color: Colors.white, |
|
|
|
|
|
)), |
|
|
|
|
|
) |
|
|
|
|
|
], |
|
|
|
|
|
)), |
|
|
), |
|
|
), |
|
|
SizedBox(height: 20.h), |
|
|
SizedBox(height: 20.h), |
|
|
|
|
|
|
|
|
// 昵称编辑 - 使用外部定义的controller而不是每次重建 |
|
|
// 昵称编辑 - 使用外部定义的controller而不是每次重建 |
|
|
TextField( |
|
|
TextField( |
|
|
controller: nameController, |
|
|
controller: nameController, |
|
|
@ -200,7 +229,7 @@ class EditProfileView extends GetView<ProfileController> { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
// ... 其他编辑项 ... |
|
|
// ... 其他编辑项 ... |
|
|
|
|
|
|
|
|
SizedBox(height: 30.h), |
|
|
SizedBox(height: 30.h), |
|
|
// 添加一个大的保存按钮 |
|
|
// 添加一个大的保存按钮 |
|
|
SizedBox( |
|
|
SizedBox( |
|
|
|