git-touch-android-ios-app/lib/widgets/label.dart

35 lines
790 B
Dart
Raw Normal View History

2020-01-12 08:44:07 +01:00
import 'package:flutter/material.dart';
import 'package:git_touch/utils/utils.dart';
class Label extends StatelessWidget {
final String name;
2020-01-14 06:33:02 +01:00
final Color color;
2020-01-12 08:44:07 +01:00
final String cssColor;
2020-01-14 06:33:02 +01:00
Label({
@required this.name,
this.color,
this.cssColor,
});
2020-01-12 08:44:07 +01:00
@override
Widget build(BuildContext context) {
2020-01-14 06:33:02 +01:00
final _color = color ?? convertColor(cssColor);
2020-01-12 08:44:07 +01:00
return Container(
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 6),
decoration: BoxDecoration(
2020-01-14 06:33:02 +01:00
color: _color,
2020-01-12 08:44:07 +01:00
borderRadius: BorderRadius.all(Radius.circular(4)),
),
child: Text(
name,
style: TextStyle(
2020-01-14 06:33:02 +01:00
fontSize: 13,
color: getFontColorByBrightness(_color),
2020-01-12 08:44:07 +01:00
fontWeight: FontWeight.w600,
),
),
);
}
}