1
0
mirror of https://github.com/git-touch/git-touch synced 2024-12-18 19:22:54 +01:00
git-touch-android-ios-app/lib/widgets/label.dart

37 lines
855 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';
2020-01-14 06:51:53 +01:00
class MyLabel extends StatelessWidget {
2020-01-12 08:44:07 +01:00
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:51:53 +01:00
final Color textColor;
2020-01-12 08:44:07 +01:00
2020-01-14 06:51:53 +01:00
MyLabel({
2020-01-14 06:33:02 +01:00
@required this.name,
this.color,
this.cssColor,
2020-01-14 06:51:53 +01:00
this.textColor,
2020-01-14 06:33:02 +01:00
});
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,
2020-01-14 06:51:53 +01:00
color: textColor ?? getFontColorByBrightness(_color),
// fontWeight: FontWeight.w600,
2020-01-12 08:44:07 +01:00
),
),
);
}
}