1
0
mirror of https://github.com/git-touch/git-touch synced 2025-01-31 08:04:51 +01:00

37 lines
855 B
Dart
Raw Normal View History

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