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