mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-28 18:39:26 -05:00
fix: hex color parse
This commit is contained in:
@@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:from_css_color/from_css_color.dart';
|
||||
|
||||
class HexColorTag extends StatelessWidget {
|
||||
|
||||
const HexColorTag({
|
||||
super.key,
|
||||
required this.name,
|
||||
@@ -14,10 +13,20 @@ class HexColorTag extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final c = fromCssColor('#$color');
|
||||
final theme = AntTheme.of(context);
|
||||
|
||||
return AntTag(
|
||||
round: true,
|
||||
color: fromCssColor(color),
|
||||
child: Text(name),
|
||||
color: c,
|
||||
child: Text(
|
||||
name,
|
||||
style: TextStyle(
|
||||
color: c.computeLuminance() > 0.5
|
||||
? theme.colorText
|
||||
: theme.colorBackground,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,8 +205,7 @@ class TimelineItem extends StatelessWidget {
|
||||
textSpan: TextSpan(children: [
|
||||
TextSpan(text: ' ${AppLocalizations.of(context)!.added} '),
|
||||
WidgetSpan(
|
||||
child: HexColorTag(
|
||||
name: p.label.name, color: '#${p.label.color}')),
|
||||
child: HexColorTag(name: p.label.name, color: p.label.color)),
|
||||
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
|
||||
]),
|
||||
);
|
||||
@@ -218,8 +217,7 @@ class TimelineItem extends StatelessWidget {
|
||||
textSpan: TextSpan(children: [
|
||||
TextSpan(text: ' ${AppLocalizations.of(context)!.removed} '),
|
||||
WidgetSpan(
|
||||
child: HexColorTag(
|
||||
name: p.label.name, color: '#${p.label.color}')),
|
||||
child: HexColorTag(name: p.label.name, color: p.label.color)),
|
||||
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
|
||||
]),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user