mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-02 07:00:35 +10:00
refactor: use UnreadBadge widget in QuickSwitchBar for consistent badge styling
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:ui';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../l10n/l10n.dart';
|
import '../l10n/l10n.dart';
|
||||||
|
import 'unread_badge.dart';
|
||||||
|
|
||||||
class QuickSwitchBar extends StatelessWidget {
|
class QuickSwitchBar extends StatelessWidget {
|
||||||
final int selectedIndex;
|
final int selectedIndex;
|
||||||
@@ -104,12 +105,16 @@ class QuickSwitchBar extends StatelessWidget {
|
|||||||
Widget _buildIconWithBadge(Icon icon, int count) {
|
Widget _buildIconWithBadge(Icon icon, int count) {
|
||||||
if (count <= 0) return icon;
|
if (count <= 0) return icon;
|
||||||
|
|
||||||
return Badge(
|
return Stack(
|
||||||
label: Text(
|
clipBehavior: Clip.none,
|
||||||
count > 99 ? '99+' : count.toString(),
|
children: [
|
||||||
style: const TextStyle(fontSize: 10),
|
icon,
|
||||||
),
|
Positioned(
|
||||||
child: icon,
|
right: -6,
|
||||||
|
top: -4,
|
||||||
|
child: UnreadBadge(count: count),
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user