Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

show badges totaled in more areas

This commit is contained in:
Henry Hiles 2026-10-15 00:42:56 -04:00
commit 66a437094a
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
6 changed files with 79 additions and 22 deletions

View file

@ -0,0 +1,16 @@
import "package:material_ui/material_ui.dart";
/// Shows [count] in a badge on [child]: nothing if null, a dot if 0, and the
/// number otherwise.
class const CountBadge(
final int? count, {
required final Widget child,
super.key,
}) extends StatelessWidget {
@override
Widget build(BuildContext context) => switch (count) {
null => child,
0 => Badge(child: child),
final count => Badge.count(count: count, child: child),
};
}