|
|
|
@ -62,156 +62,155 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
return GestureDetector( |
|
|
|
onTap: () => Get.toNamed(Routes.editProfile), |
|
|
|
child: Container( |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
gradient: LinearGradient( |
|
|
|
colors: isDarkMode |
|
|
|
? [ |
|
|
|
const Color(0xFF1A1A1A).withOpacity(0.7), |
|
|
|
const Color(0xFF2A2A2A).withOpacity(0.7) |
|
|
|
] |
|
|
|
: [const Color(0xFFE3F2FD), const Color(0xFFF3E5F5)], |
|
|
|
begin: Alignment.topLeft, |
|
|
|
end: Alignment.bottomRight, |
|
|
|
), |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.black.withOpacity(0.2) |
|
|
|
: Colors.black.withOpacity(0.05), |
|
|
|
blurRadius: 10, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
padding: EdgeInsets.all(16.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
gradient: LinearGradient( |
|
|
|
colors: isDarkMode |
|
|
|
? [ |
|
|
|
const Color(0xFF1A1A1A).withOpacity(0.7), |
|
|
|
const Color(0xFF2A2A2A).withOpacity(0.7) |
|
|
|
] |
|
|
|
: [const Color(0xFFE3F2FD), const Color(0xFFF3E5F5)], |
|
|
|
begin: Alignment.topLeft, |
|
|
|
end: Alignment.bottomRight, |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: ClipRRect( |
|
|
|
//裁剪圆角矩形 |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
child: BackdropFilter( |
|
|
|
filter: isDarkMode |
|
|
|
? ImageFilter.blur(sigmaX: 10, sigmaY: 10) |
|
|
|
: ImageFilter.blur(sigmaX: 0, sigmaY: 0), |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Obx(() => GestureDetector( |
|
|
|
//onTap: ()=>controller.updateUserAvatar(), |
|
|
|
child: Container( |
|
|
|
//用户头像部分 |
|
|
|
width: 60.w, |
|
|
|
height: 60.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(30.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withOpacity(0.1), |
|
|
|
blurRadius: 8, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: ClipRRect( |
|
|
|
// 裁剪圆形头像 |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.black.withOpacity(0.2) |
|
|
|
: Colors.black.withOpacity(0.05), |
|
|
|
blurRadius: 10, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: ClipRRect( |
|
|
|
//裁剪圆角矩形 |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
child: BackdropFilter( |
|
|
|
filter: isDarkMode |
|
|
|
? ImageFilter.blur(sigmaX: 10, sigmaY: 10) |
|
|
|
: ImageFilter.blur(sigmaX: 0, sigmaY: 0), |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
Obx(() => GestureDetector( |
|
|
|
//onTap: ()=>controller.updateUserAvatar(), |
|
|
|
child: Container( |
|
|
|
//用户头像部分 |
|
|
|
width: 60.w, |
|
|
|
height: 60.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(30.r), |
|
|
|
child: controller.userInfo.value.avatar.isEmpty |
|
|
|
? |
|
|
|
Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.blue[600], |
|
|
|
borderRadius: BorderRadius.circular(30.r), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
controller |
|
|
|
.userInfo.value.name.isNotEmpty |
|
|
|
? controller.userInfo.value.name[0] |
|
|
|
.toUpperCase() |
|
|
|
: '?', |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white, |
|
|
|
fontSize: 24.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withOpacity(0.1), |
|
|
|
blurRadius: 8, |
|
|
|
offset: const Offset(0, 2), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: ClipRRect( |
|
|
|
// 裁剪圆形头像 |
|
|
|
borderRadius: BorderRadius.circular(30.r), |
|
|
|
child: controller.userInfo.value.avatar.isEmpty |
|
|
|
? Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.blue[600], |
|
|
|
borderRadius: BorderRadius.circular(30.r), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
: Image.network( |
|
|
|
controller.userInfo.value.avatar, |
|
|
|
fit: BoxFit.cover, |
|
|
|
errorBuilder: (context, error, stackTrace) { |
|
|
|
// 当图片加载失败时显示用户名首字母 |
|
|
|
return Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.blue[600], |
|
|
|
borderRadius: |
|
|
|
BorderRadius.circular(30.r), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
controller |
|
|
|
.userInfo.value.name.isNotEmpty |
|
|
|
? controller.userInfo.value.name[0] |
|
|
|
.toUpperCase() |
|
|
|
: '?', |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white, |
|
|
|
fontSize: 24.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
controller.userInfo.value.name |
|
|
|
.isNotEmpty |
|
|
|
? controller |
|
|
|
.userInfo.value.name[0] |
|
|
|
.toUpperCase() |
|
|
|
: '?', |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white, |
|
|
|
fontSize: 24.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
), |
|
|
|
) |
|
|
|
: Image.network( |
|
|
|
controller.userInfo.value.avatar, |
|
|
|
fit: BoxFit.cover, |
|
|
|
errorBuilder: (context, error, stackTrace) { |
|
|
|
// 当图片加载失败时显示用户名首字母 |
|
|
|
return Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.blue[600], |
|
|
|
borderRadius: |
|
|
|
BorderRadius.circular(30.r), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
controller.userInfo.value.name |
|
|
|
.isNotEmpty |
|
|
|
? controller |
|
|
|
.userInfo.value.name[0] |
|
|
|
.toUpperCase() |
|
|
|
: '?', |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.white, |
|
|
|
fontSize: 24.sp, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
)), |
|
|
|
), |
|
|
|
)), |
|
|
|
SizedBox(width: 16.w), |
|
|
|
Expanded( |
|
|
|
// 占据剩余空间 |
|
|
|
child: Obx( |
|
|
|
() => Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, // 左对齐 |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
//用户名 |
|
|
|
controller.userInfo.value.name, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
); |
|
|
|
}, |
|
|
|
)), |
|
|
|
), |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
horizontal: 8.w, vertical: 2.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.blue[600], |
|
|
|
borderRadius: BorderRadius.circular(10.r), |
|
|
|
), |
|
|
|
child: Obx(() { |
|
|
|
final membershipMap = { |
|
|
|
0: 'freeUser', //'免费用户' |
|
|
|
1: 'standardUser', //'标准用户' |
|
|
|
2: 'proUser', //'专业用户' |
|
|
|
}; |
|
|
|
final membershipString = membershipMap[ |
|
|
|
controller |
|
|
|
.userInfo.value.membershipLevel] ?? |
|
|
|
'Unknown'; |
|
|
|
return Text( |
|
|
|
membershipString, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10.sp, |
|
|
|
color: Colors.white, |
|
|
|
), |
|
|
|
); |
|
|
|
}), |
|
|
|
)), |
|
|
|
SizedBox(width: 16.w), |
|
|
|
Expanded( |
|
|
|
// 占据剩余空间 |
|
|
|
child: Obx( |
|
|
|
() => Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, // 左对齐 |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
//用户名 |
|
|
|
controller.userInfo.value.name, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 18.sp, |
|
|
|
fontWeight: FontWeight.w600, |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
horizontal: 8.w, vertical: 2.h), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.blue[600], |
|
|
|
borderRadius: BorderRadius.circular(10.r), |
|
|
|
), |
|
|
|
child: Obx(() { |
|
|
|
final membershipMap = { |
|
|
|
0: 'freeUser', //'免费用户' |
|
|
|
1: 'standardUser', //'标准用户' |
|
|
|
2: 'proUser', //'专业用户' |
|
|
|
}; |
|
|
|
final membershipString = membershipMap[ |
|
|
|
controller |
|
|
|
.userInfo.value.membershipLevel] ?? |
|
|
|
'Unknown'; |
|
|
|
return Text( |
|
|
|
membershipString, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10.sp, |
|
|
|
color: Colors.white, |
|
|
|
), |
|
|
|
); |
|
|
|
}), |
|
|
|
), |
|
|
|
// SizedBox(width: 8.w), |
|
|
|
// Flexible( |
|
|
|
// child: Text( |
|
|
|
@ -225,46 +224,46 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
// overflow: TextOverflow.ellipsis, |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Text( |
|
|
|
], |
|
|
|
), |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Text( |
|
|
|
'ID:${controller.userInfo.value.uid}', |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Container( |
|
|
|
// 编辑按钮 |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.white.withOpacity(0.7), |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withOpacity(0.05), |
|
|
|
blurRadius: 4, |
|
|
|
offset: const Offset(0, 1), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
child: InkWell( |
|
|
|
onTap: () => Get.toNamed(Routes.editProfile), |
|
|
|
child: Icon( |
|
|
|
Icons.edit, |
|
|
|
size: 16.w, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600], |
|
|
|
Container( |
|
|
|
// 编辑按钮 |
|
|
|
width: 32.w, |
|
|
|
height: 32.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.white.withOpacity(0.7), |
|
|
|
borderRadius: BorderRadius.circular(16.r), |
|
|
|
boxShadow: [ |
|
|
|
BoxShadow( |
|
|
|
color: Colors.black.withOpacity(0.05), |
|
|
|
blurRadius: 4, |
|
|
|
offset: const Offset(0, 1), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
)), |
|
|
|
], |
|
|
|
child: InkWell( |
|
|
|
onTap: () => Get.toNamed(Routes.editProfile), |
|
|
|
child: Icon( |
|
|
|
Icons.edit, |
|
|
|
size: 16.w, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600], |
|
|
|
), |
|
|
|
)), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -572,7 +571,7 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
_buildSimpleNavigationSetting( |
|
|
|
title: 'ota升级', |
|
|
|
subtitle: '测试ble耳机固件版本升级', |
|
|
|
icon: Icons.record_voice_over, |
|
|
|
icon: Icons.system_update_alt, |
|
|
|
iconBgColor: isDarkMode |
|
|
|
? Colors.orange[900]!.withOpacity(0.3) |
|
|
|
: Colors.orange[100]!, |
|
|
|
@ -581,11 +580,11 @@ class SettingsView extends GetView<SettingsController> { |
|
|
|
onTap: () => Get.toNamed(Routes.OTA_UPGRADE), |
|
|
|
isDarkMode: isDarkMode, |
|
|
|
), |
|
|
|
Divider( |
|
|
|
height: 1, |
|
|
|
color: isDarkMode |
|
|
|
? Colors.white.withOpacity(0.1) |
|
|
|
: Colors.grey[200]), |
|
|
|
// Divider( |
|
|
|
// height: 1, |
|
|
|
// color: isDarkMode |
|
|
|
// ? Colors.white.withOpacity(0.1) |
|
|
|
// : Colors.grey[200]), |
|
|
|
|
|
|
|
// 退出登录 |
|
|
|
// _buildSimpleNavigationSetting( |
|
|
|
|