Browse Source

优化个人中心,修复设置无法打开的问题

ios
王子贤 4 months ago
parent
commit
f169176511
3 changed files with 153 additions and 135 deletions
  1. 9
      lib/pages/home/user_information_page.dart
  2. 29
      lib/pages/mine/mine_page.dart
  3. 250
      lib/pages/setting/setting_page.dart

9
lib/pages/home/user_information_page.dart

@ -88,7 +88,12 @@ class UserInformationPage extends StatelessWidget {
),
SizedBox(width: 2.w,),
Text(
"${controller.userData.value.age}",
"${
controller.calculateAge(
(controller.userData.value.birthDate != null && controller.userData.value.birthDate!.isNotEmpty) ?
(controller.userData.value.birthDate ?? "") : controller.userData.value.birthYear != null && controller.userData.value.birthYear!.isNotEmpty ?
"${controller.userData.value.birthYear}-01-01" : "")
}",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(255, 66, 236, 1)
@ -161,7 +166,7 @@ class UserInformationPage extends StatelessWidget {
),
SizedBox(width: 2.w,),
Text(
"${controller.userData.value.age}",
"${controller.calculateAge(controller.userData.value.birthDate ?? "${controller.userData.value.birthYear}-01-01" ?? "")}",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(120, 140, 255, 1)

29
lib/pages/mine/mine_page.dart

@ -115,10 +115,25 @@ class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
),
),
SizedBox(width: 8.w,),
Image.asset(
Assets.imagesVip,
width: 44.w,
// Image.asset(
// Assets.imagesVip,
// width: 44.w,
// height: 16.w,
// )
Container(
width: 32.w,
height: 16.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(16.w)),
color: const Color.fromRGBO(201, 201, 201, 1)
),
child: Center(
child: Image.asset(
Assets.imagesVipFont,
width: 20.w,
height: 8.w,
),
),
)
],
),
@ -192,12 +207,12 @@ class _MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin{
height: 64.w,
),
Positioned(
top: 18.w,
right: 15.w,
top: 0.w,
left: 0.w,
child: InkWell(
child: SizedBox(
width: 73.w,
height: 28.w,
width: 356.w,
height: 64.w,
).onTap((){
Get.to(() => VipPage());
}),

250
lib/pages/setting/setting_page.dart

@ -19,134 +19,132 @@ class SettingPage extends StatelessWidget {
return Scaffold(
backgroundColor: Color(0xffF5F5F5),
appBar: PageAppbar(title: "设置"),
body: Expanded(
child: SingleChildScrollView(
padding: EdgeInsetsGeometry.symmetric(vertical: 16.w),
child: Obx(() {
return Column(
children: [
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(
arrow: false,
height: 60.h,
title: '允许中间邀请弹窗',
rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) {
return false;
})
),
TDCell(
arrow: false,
height: 60.h,
title: '后台播放',
rightIconWidget: TDSwitch(
isOn: true,
trackOnColor: const Color.fromRGBO(117, 98, 249, 1),
onChanged: (bool e) {
return false;
},
)
),
TDCell(
arrow: false,
height: 60.h,
title: '语音/视频通话提示音',
rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) {
body: SingleChildScrollView(
padding: EdgeInsetsGeometry.symmetric(vertical: 16.w),
child: Obx(() {
return Column(
children: [
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(
arrow: false,
height: 60.h,
title: '允许中间邀请弹窗',
rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) {
return false;
})
),
TDCell(
arrow: false,
height: 60.h,
title: '后台播放',
rightIconWidget: TDSwitch(
isOn: true,
trackOnColor: const Color.fromRGBO(117, 98, 249, 1),
onChanged: (bool e) {
return false;
})
),
],
),
const SizedBox(height: 12),
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, height: 60.h, title: '安全中心', onClick: (cell) {
print('安全中心');
}),
TDCell(arrow: true, height: 60.h, title: '黑名单', onClick: (cell) {
Get.to(() => BlacklistPage());
}),
],
),
const SizedBox(height: 12),
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, height: 60.h, title: '系统权限管理'),
TDCell(arrow: true, height: 60.h, title: '消息通知', onClick: (cell) {
Get.to(() => NoticePage());
}),
TDCell(arrow: true, height: 60.h, title: '检查更新', onClick: (cell) {
// _showUpdateDialog();
controller.checkVersion();
},
noteWidget: Text('当前版本:${controller.version.value}',style: TextStyle(fontSize: 13.w,color: const Color.fromRGBO(117, 98, 249, 1))),
)
],
),
const SizedBox(height: 64),
TDButton(
text: '退出登录',
width: MediaQuery.of(context).size.width - 40,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<
double> animation,
Animation<double> secondaryAnimation) {
return TDAlertDialog(
title: '是否退出当前账号?',
buttonWidget: Container(
padding: EdgeInsetsGeometry.only(top: 16.w,
right: 30.w,
left: 30.w,
bottom: 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TDButton(
text: '取 消',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.defaultTheme,
onTap: () {
Navigator.of(context).pop();
},
),
TDButton(
text: '确 定',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
controller.logout();
Get.offAll(() => LoginPage());
},
),
],
),
)
);
},
);
},
)
),
TDCell(
arrow: false,
height: 60.h,
title: '语音/视频通话提示音',
rightIconWidget: TDSwitch(isOn: false,trackOnColor: const Color.fromRGBO(117, 98, 249, 1),onChanged: (bool e) {
return false;
})
),
],
),
const SizedBox(height: 12),
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, height: 60.h, title: '安全中心', onClick: (cell) {
print('安全中心');
}),
TDCell(arrow: true, height: 60.h, title: '黑名单', onClick: (cell) {
Get.to(() => BlacklistPage());
}),
],
),
const SizedBox(height: 12),
TDCellGroup(
theme: TDCellGroupTheme.cardTheme,
cells: [
TDCell(arrow: true, height: 60.h, title: '系统权限管理'),
TDCell(arrow: true, height: 60.h, title: '消息通知', onClick: (cell) {
Get.to(() => NoticePage());
}),
TDCell(arrow: true, height: 60.h, title: '检查更新', onClick: (cell) {
// _showUpdateDialog();
controller.checkVersion();
},
),
const SizedBox(height: 24),
],
);
}),
),
noteWidget: Text('当前版本:${controller.version.value}',style: TextStyle(fontSize: 13.w,color: const Color.fromRGBO(117, 98, 249, 1))),
)
],
),
const SizedBox(height: 64),
TDButton(
text: '退出登录',
width: MediaQuery.of(context).size.width - 40,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
showGeneralDialog(
context: context,
pageBuilder: (BuildContext buildContext, Animation<
double> animation,
Animation<double> secondaryAnimation) {
return TDAlertDialog(
title: '是否退出当前账号?',
buttonWidget: Container(
padding: EdgeInsetsGeometry.only(top: 16.w,
right: 30.w,
left: 30.w,
bottom: 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TDButton(
text: '取 消',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.defaultTheme,
onTap: () {
Navigator.of(context).pop();
},
),
TDButton(
text: '确 定',
width: 120,
size: TDButtonSize.large,
type: TDButtonType.fill,
shape: TDButtonShape.round,
theme: TDButtonTheme.danger,
onTap: () {
controller.logout();
Get.offAll(() => LoginPage());
},
),
],
),
)
);
},
);
},
),
const SizedBox(height: 24),
],
);
}),
),
);
}

Loading…
Cancel
Save