mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: msg badge
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -90,11 +90,20 @@ class _HomePageState extends State<HomePage>
|
|||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Obx(
|
Obx(
|
||||||
() => _homeController.isLogin.value
|
() => _homeController.isLogin.value
|
||||||
? Stack(
|
? Badge(
|
||||||
clipBehavior: Clip.none,
|
isLabelVisible:
|
||||||
alignment: Alignment.center,
|
_mainController.msgBadgeMode != DynamicBadgeMode.hidden &&
|
||||||
children: [
|
_mainController.msgUnReadCount.value.isNotEmpty,
|
||||||
IconButton(
|
alignment:
|
||||||
|
_mainController.msgBadgeMode == DynamicBadgeMode.number
|
||||||
|
? Alignment(0, -0.5)
|
||||||
|
: Alignment(0.5, -0.5),
|
||||||
|
label: _mainController.msgBadgeMode ==
|
||||||
|
DynamicBadgeMode.number &&
|
||||||
|
_mainController.msgUnReadCount.value.isNotEmpty
|
||||||
|
? Text(_mainController.msgUnReadCount.value.toString())
|
||||||
|
: null,
|
||||||
|
child: IconButton(
|
||||||
tooltip: '消息',
|
tooltip: '消息',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.toNamed('/whisper');
|
Get.toNamed('/whisper');
|
||||||
@@ -104,29 +113,6 @@ class _HomePageState extends State<HomePage>
|
|||||||
Icons.notifications_none,
|
Icons.notifications_none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_mainController.msgBadgeMode !=
|
|
||||||
DynamicBadgeMode.hidden &&
|
|
||||||
_mainController.msgUnReadCount.value.isNotEmpty)
|
|
||||||
Positioned(
|
|
||||||
top: _mainController.msgBadgeMode ==
|
|
||||||
DynamicBadgeMode.number
|
|
||||||
? 8
|
|
||||||
: 12,
|
|
||||||
left: _mainController.msgBadgeMode ==
|
|
||||||
DynamicBadgeMode.number
|
|
||||||
? 22
|
|
||||||
: 32,
|
|
||||||
child: IgnorePointer(
|
|
||||||
child: Badge(
|
|
||||||
label: _mainController.msgBadgeMode ==
|
|
||||||
DynamicBadgeMode.number
|
|
||||||
? Text(_mainController.msgUnReadCount.value
|
|
||||||
.toString())
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -434,11 +434,20 @@ class _MainAppState extends State<MainApp>
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Obx(
|
Obx(
|
||||||
() => _homeController.isLogin.value
|
() => _homeController.isLogin.value
|
||||||
? Stack(
|
? Badge(
|
||||||
clipBehavior: Clip.none,
|
isLabelVisible:
|
||||||
alignment: Alignment.center,
|
_mainController.msgBadgeMode != DynamicBadgeMode.hidden &&
|
||||||
children: [
|
_mainController.msgUnReadCount.value.isNotEmpty,
|
||||||
IconButton(
|
alignment:
|
||||||
|
_mainController.msgBadgeMode == DynamicBadgeMode.number
|
||||||
|
? Alignment(0, -0.5)
|
||||||
|
: Alignment(0.5, -0.5),
|
||||||
|
label: _mainController.msgBadgeMode ==
|
||||||
|
DynamicBadgeMode.number &&
|
||||||
|
_mainController.msgUnReadCount.value.isNotEmpty
|
||||||
|
? Text(_mainController.msgUnReadCount.value.toString())
|
||||||
|
: null,
|
||||||
|
child: IconButton(
|
||||||
tooltip: '消息',
|
tooltip: '消息',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.toNamed('/whisper');
|
Get.toNamed('/whisper');
|
||||||
@@ -448,29 +457,6 @@ class _MainAppState extends State<MainApp>
|
|||||||
Icons.notifications_none,
|
Icons.notifications_none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (_mainController.msgBadgeMode !=
|
|
||||||
DynamicBadgeMode.hidden &&
|
|
||||||
_mainController.msgUnReadCount.value.isNotEmpty)
|
|
||||||
Positioned(
|
|
||||||
top: _mainController.msgBadgeMode ==
|
|
||||||
DynamicBadgeMode.number
|
|
||||||
? 8
|
|
||||||
: 12,
|
|
||||||
left: _mainController.msgBadgeMode ==
|
|
||||||
DynamicBadgeMode.number
|
|
||||||
? 22
|
|
||||||
: 32,
|
|
||||||
child: IgnorePointer(
|
|
||||||
child: Badge(
|
|
||||||
label: _mainController.msgBadgeMode ==
|
|
||||||
DynamicBadgeMode.number
|
|
||||||
? Text(_mainController.msgUnReadCount.value
|
|
||||||
.toString())
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
: const SizedBox.shrink(),
|
: const SizedBox.shrink(),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user