chore: update icon color for error indicator (#5757)

This commit is contained in:
ggurdin 2026-02-19 10:51:22 -05:00 committed by GitHub
parent c9d70ab5d8
commit e933df7e36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 27 deletions

View file

@ -1,8 +1,11 @@
import 'package:flutter/material.dart';
import 'package:fluffychat/config/app_config.dart';
class ErrorIndicator extends StatelessWidget {
final String message;
final double? iconSize;
final Color? iconColor;
final TextStyle? style;
final VoidCallback? onTap;
@ -10,25 +13,28 @@ class ErrorIndicator extends StatelessWidget {
super.key,
required this.message,
this.iconSize,
this.iconColor,
this.style,
this.onTap,
});
@override
Widget build(BuildContext context) {
final content = Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.error,
color: Theme.of(context).colorScheme.error,
size: iconSize ?? 24.0,
),
const SizedBox(width: 8),
Flexible(
child: Text(message, style: style, textAlign: TextAlign.center),
),
],
final content = RichText(
text: TextSpan(
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Icon(
Icons.error,
color: iconColor ?? AppConfig.error,
size: iconSize ?? 24.0,
),
),
TextSpan(text: ' '),
TextSpan(text: message, style: style),
],
),
);
if (onTap != null) {

View file

@ -367,20 +367,9 @@ class _MessageSelectModeContent extends StatelessWidget {
),
],
),
AsyncError(error: final _) => Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.error_outline,
color: Theme.of(context).colorScheme.error,
),
const SizedBox(width: 8),
Text(
L10n.of(context).translationError,
textScaler: TextScaler.noScaling,
style: style.copyWith(fontStyle: FontStyle.italic),
),
],
AsyncError(error: final _) => ErrorIndicator(
message: L10n.of(context).translationError,
style: style.copyWith(fontStyle: FontStyle.italic),
),
AsyncLoaded(value: final value) => Container(
constraints: BoxConstraints(maxWidth: maxWidth),