Skip to content

Commit

Permalink
msglist: Make DM recipient header icon (ZulipIcons.user) match text c…
Browse files Browse the repository at this point in the history
…olor

As it does in the Figma.
  • Loading branch information
chrisbobbe committed May 20, 2024
1 parent 3b5f5ca commit 467b821
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions test/flutter_checks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extension TextFieldChecks on Subject<TextField> {

extension TextStyleChecks on Subject<TextStyle> {
Subject<bool> get inherit => has((t) => t.inherit, 'inherit');
Subject<Color?> get color => has((t) => t.color, 'color');
Subject<double?> get fontSize => has((t) => t.fontSize, 'fontSize');
Subject<FontWeight?> get fontWeight => has((t) => t.fontWeight, 'fontWeight');
Subject<double?> get letterSpacing => has((t) => t.letterSpacing, 'letterSpacing');
Expand Down
15 changes: 15 additions & 0 deletions test/widgets/message_list_test.dart
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<RenderParagraph>(find.text(
zulipLocalizations.messageListGroupYouAndOthers(
zulipLocalizations.unknownUserName))).text;
final icon = tester.widget<Icon>(find.byIcon(ZulipIcons.user));
check(textSpan).style.isNotNull().color.equals(icon.color);
});
});

testWidgets('show dates', (tester) async {
Expand Down

0 comments on commit 467b821

Please sign in to comment.