From 0aeca52fa8dd7053bcea75a6977fa5e51f439037 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Sun, 19 May 2024 17:15:02 -0700 Subject: [PATCH] msglist: Make DM recipient header icon (ZulipIcons.user) match text color As it does in the Figma. (Before, the color was the Material constant kDefaultIconDarkColor, which is Color(0xDD000000).) --- lib/widgets/message_list.dart | 9 ++++++--- test/flutter_checks.dart | 1 + test/widgets/message_list_test.dart | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/widgets/message_list.dart b/lib/widgets/message_list.dart index 8ee6499a47..12ae8eb048 100644 --- a/lib/widgets/message_list.dart +++ b/lib/widgets/message_list.dart @@ -765,9 +765,12 @@ class DmRecipientHeader extends StatelessWidget { child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Padding( - padding: EdgeInsets.symmetric(horizontal: 6), - child: Icon(size: 16, ZulipIcons.user)), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 6), + child: Icon( + color: _kRecipientHeaderTextColor, + size: 16, + ZulipIcons.user)), Expanded( child: Text(title, style: recipientHeaderTextStyle(context), diff --git a/test/flutter_checks.dart b/test/flutter_checks.dart index 68cc8eef89..c76d59843d 100644 --- a/test/flutter_checks.dart +++ b/test/flutter_checks.dart @@ -66,6 +66,7 @@ extension TextFieldChecks on Subject { extension TextStyleChecks on Subject { Subject get inherit => has((t) => t.inherit, 'inherit'); + Subject get color => has((t) => t.color, 'color'); Subject get fontSize => has((t) => t.fontSize, 'fontSize'); Subject get fontWeight => has((t) => t.fontWeight, 'fontWeight'); Subject get letterSpacing => has((t) => t.letterSpacing, 'letterSpacing'); diff --git a/test/widgets/message_list_test.dart b/test/widgets/message_list_test.dart index aef418041c..12e29eae11 100644 --- a/test/widgets/message_list_test.dart +++ b/test/widgets/message_list_test.dart @@ -1,7 +1,9 @@ import 'dart:convert'; import 'package:checks/checks.dart'; +import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; import 'package:flutter_gen/gen_l10n/zulip_localizations.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:http/http.dart' as http; @@ -399,6 +401,19 @@ void main() { tester.widget(find.text(zulipLocalizations.messageListGroupYouAndOthers( "${zulipLocalizations.unknownUserName}, ${eg.thirdUser.fullName}"))); }); + + testWidgets('icon color matches text color', (tester) async { + final zulipLocalizations = GlobalLocalizations.zulipLocalizations; + await setupMessageListPage(tester, messages: [ + eg.dmMessage(from: eg.otherUser, to: [eg.selfUser]), + ]); + await tester.pump(); + final textSpan = tester.renderObject(find.text( + zulipLocalizations.messageListGroupYouAndOthers( + zulipLocalizations.unknownUserName))).text; + final icon = tester.widget(find.byIcon(ZulipIcons.user)); + check(textSpan).style.isNotNull().color.equals(icon.color); + }); }); testWidgets('show dates', (tester) async {