更新消息小红点未读显示

This commit is contained in:
wyf
2025-12-10 16:59:29 +08:00
parent fb5a17830b
commit f2657e4238
5 changed files with 75 additions and 54 deletions

View File

@@ -319,24 +319,45 @@ class _HomePageState extends State<HomePage> {
mainAxisAlignment:
MainAxisAlignment.end,
children: [
Container(
constraints: BoxConstraints(
maxWidth:
bodySize.maxWidth *
0.6),
child: Text(
userInfoController.model.user!
.nick_name ??
'未命名'.tr,
style: TextStyle(
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
ClickableContainer(
backgroundColor:
Colors.transparent,
highlightColor:
Colors.transparent,
padding: EdgeInsets.all(0),
onTap: () async {
int login = userInfoController
.model.login!;
if (login == 1) {
await Get.toNamed(
"/updateUserPage");
await userInfoController
.getUserInfo();
userInfoController
.updateAll();
} else {
Get.toNamed("/loginPage");
}
},
child: Container(
constraints: BoxConstraints(
maxWidth:
bodySize.maxWidth *
0.6),
child: Text(
userInfoController.model
.user!.nick_name ??
'未命名'.tr,
style: TextStyle(
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
maxLines: 1,
overflow:
TextOverflow.ellipsis,
),
maxLines: 1,
overflow:
TextOverflow.ellipsis,
),
),
// Obx(() {

View File

@@ -321,8 +321,7 @@ class MainPageBottomChange extends GetView<MainPageController> {
"assets/img/menu/e.svg", "assets/img/menu/n_e.svg", "菜单.小e".tr),
getBottomNavigationBarItem("assets/img/menu/message.svg",
"assets/img/menu/n_message.svg", "菜单.消息".tr,
showBadge: (messageController.model.body_message_read == 1 ||
messageController.model.system_message_read == 1)),
showBadge: true),
getBottomNavigationBarItem("assets/img/menu/mine.svg",
"assets/img/menu/n_mine.svg", "菜单.我的".tr),
];
@@ -350,34 +349,38 @@ class MainPageBottomChange extends GetView<MainPageController> {
if (size == 0) size = 36.rpx;
Widget buildIcon(String path) {
return Padding(
padding: EdgeInsets.only(bottom: 6.rpx),
child: isEmpty
? Container()
: Stack(
clipBehavior: Clip.none,
children: [
SvgPicture.asset(
path,
width: size,
height: size,
),
if (showBadge)
Positioned(
right: -20.rpx,
top: -2.rpx,
child: Container(
width: 14.rpx,
height: 14.rpx,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
return Obx(() {
int type1 = messageController.model.body_message_read!;
int type2 = messageController.model.system_message_read!;
return Padding(
padding: EdgeInsets.only(bottom: 6.rpx),
child: isEmpty
? Container()
: Stack(
clipBehavior: Clip.none,
children: [
SvgPicture.asset(
path,
width: size,
height: size,
),
if ((type1 == 1 || type2 == 1) && showBadge)
Positioned(
right: -20.rpx,
top: -2.rpx,
child: Container(
width: 14.rpx,
height: 14.rpx,
decoration: const BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
),
),
),
),
],
),
);
],
),
);
});
}
return BottomNavigationBarItem(

View File

@@ -703,7 +703,7 @@ class _MinePageState extends State<MinePage> {
mainAxisSize: MainAxisSize.max,
children: [
Text(
'V1.0.2512.09',
'V1.0.2512.10',
style: TextStyle(
fontFamily: 'Inter',
// color: Color(0xFFD9E3EB),