Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions lib/widgets/inbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ class _TopicItem extends StatelessWidget {
final visibilityIcon = iconDataForTopicVisibilityPolicy(
store.topicVisibilityPolicy(streamId, topic));

final unresolvedTopic = topic.unresolve();

return Material(
color: designVariables.background, // TODO(design) check if this is the right variable
child: InkWell(
Expand All @@ -551,20 +553,32 @@ class _TopicItem extends StatelessWidget {
someMessageIdInTopic: lastUnreadId),
child: ConstrainedBox(constraints: const BoxConstraints(minHeight: 34),
child: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
const SizedBox(width: 63),
SizedBox(
width: 55,
child: Align(
// End-align so that the icon grows startward as the device
// text-size setting increases, instead of shrinking the space
// available for the topic text.
alignment: AlignmentDirectional.centerEnd,
child: topic.isResolved
? _IconMarker(icon: ZulipIcons.check, padEnd: false)
: null)),
const SizedBox(width: 8),
Expanded(child: Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: Text(
style: TextStyle(
fontSize: 17,
height: (20 / 17),
fontStyle: topic.displayName == null ? FontStyle.italic : null,
fontStyle: unresolvedTopic.displayName == null
? FontStyle.italic
: null,
// TODO(design) check if this is the right variable
color: designVariables.labelMenuButton,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
topic.displayName ?? store.realmEmptyTopicDisplayName))),
unresolvedTopic.displayName ?? store.realmEmptyTopicDisplayName))),
const SizedBox(width: 12),
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
// TODO(design) copies the "@" marker color; is there a better color?
Expand All @@ -580,19 +594,28 @@ class _TopicItem extends StatelessWidget {
}

class _IconMarker extends StatelessWidget {
const _IconMarker({required this.icon});
const _IconMarker({required this.icon, this.padEnd = true});

final IconData icon;
final bool padEnd;

@override
Widget build(BuildContext context) {
final designVariables = DesignVariables.of(context);
final textScaler = MediaQuery.textScalerOf(context);
// Design for icon markers based on Figma screen:
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?type=design&node-id=224-16386&mode=design&t=JsNndFQ8fKFH0SjS-0
return Padding(
padding: const EdgeInsetsDirectional.only(end: 4),
Widget result = Icon(
size: textScaler.clamp(maxScaleFactor: 1.5).scale(16),
// This color comes from the Figma screen for the "@" marker, but not
// the topic visibility markers.
child: Icon(icon, size: 14, color: designVariables.inboxItemIconMarker));
color: designVariables.inboxItemIconMarker,
icon);
if (padEnd) {
result = Padding(
padding: const EdgeInsetsDirectional.only(end: 4),
child: result);
}
return result;
}
}
3 changes: 1 addition & 2 deletions lib/widgets/topic_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import '../model/topics.dart';
import '../model/unreads.dart';
import 'action_sheet.dart';
import 'app_bar.dart';
import 'color.dart';
import 'icons.dart';
import 'message_list.dart';
import 'page.dart';
Expand Down Expand Up @@ -328,6 +327,6 @@ class _IconMarker extends StatelessWidget {
// from the Figma design is omitted.
return Icon(icon,
size: textScaler.clamp(maxScaleFactor: 1.5).scale(16),
color: designVariables.textMessage.withFadedAlpha(0.4));
color: designVariables.inboxItemIconMarker);
}
}
24 changes: 24 additions & 0 deletions test/widgets/inbox_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,30 @@ void main() {
});
});

testWidgets('check icon present/absent as topic is resolved/unresolved', (tester) async {
final channel = eg.stream();
const topic = '✔ resolved topic';
final message = eg.streamMessage(stream: channel, topic: topic);

await setupPage(tester,
streams: [channel],
subscriptions: [eg.subscription(channel)],
unreadMessages: [message]);
await tester.pump();
check(hasIcon(tester,
parent: findRowByLabel(tester, 'resolved topic'),
icon: ZulipIcons.check)).isTrue();
check(find.textContaining('✔')).findsNothing();

await store.handleEvent(
eg.updateMessageEventMoveFrom(origMessages: [message],
newTopic: eg.t('unresolved topic')));
await tester.pump();
check(hasIcon(tester,
parent: findRowByLabel(tester, 'unresolved topic'),
icon: ZulipIcons.check)).isFalse();
});

group('collapsing', () {
Icon findHeaderCollapseIcon(WidgetTester tester, Widget headerRow) {
return tester.widget(
Expand Down