reorganize and rename widgets
This commit is contained in:
parent
05d25869ef
commit
d5f29dc344
1 changed files with 568 additions and 547 deletions
16
lib/widgets/common/count_badge.dart
Normal file
16
lib/widgets/common/count_badge.dart
Normal 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),
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue