lemmur-app-android/lib/widgets/badge.dart

30 lines
687 B
Dart
Raw Normal View History

2020-09-01 21:59:00 +02:00
import 'package:flutter/material.dart';
2020-09-30 19:05:00 +02:00
/// A badge with accent color as background
2020-09-01 21:59:00 +02:00
class Badge extends StatelessWidget {
final Widget child;
final BorderRadiusGeometry borderRadius;
2020-09-01 21:59:00 +02:00
2021-01-03 18:21:56 +01:00
const Badge({
@required this.child,
2020-09-28 22:35:48 +02:00
this.borderRadius = const BorderRadius.all(Radius.circular(10)),
});
2020-09-01 21:59:00 +02:00
@override
Widget build(BuildContext context) {
2020-09-16 23:22:04 +02:00
final theme = Theme.of(context);
2020-09-01 21:59:00 +02:00
return Container(
height: 25,
decoration: BoxDecoration(
color: theme.accentColor,
borderRadius: borderRadius,
2020-09-01 21:59:00 +02:00
),
child: Padding(
2020-09-03 22:14:07 +02:00
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
2020-09-01 21:59:00 +02:00
child: child,
),
);
}
}