fix: tag color with dark theme

This commit is contained in:
Rongjian Zhang 2022-10-08 01:40:38 +08:00
parent 3d21b6c226
commit ad44495236
1 changed files with 3 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import 'package:antd_mobile/antd_mobile.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/cupertino.dart';
import 'package:from_css_color/from_css_color.dart';
class HexColorTag extends StatelessWidget {
@ -14,7 +14,6 @@ class HexColorTag extends StatelessWidget {
@override
Widget build(BuildContext context) {
final c = fromCssColor('#$color');
final theme = AntTheme.of(context);
return AntTag(
round: true,
@ -23,8 +22,8 @@ class HexColorTag extends StatelessWidget {
name,
style: TextStyle(
color: c.computeLuminance() > 0.5
? theme.colorText
: theme.colorBackground,
? CupertinoColors.black
: CupertinoColors.white,
),
),
);