Skip to content
Closed
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
32 changes: 24 additions & 8 deletions lib/widgets/compose_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -579,23 +579,39 @@ class _StreamContentInputState extends State<_StreamContentInput> {
super.dispose();
}

/// The topic name to show in the hint text, or null to show no topic.
TopicName? _hintTopic() {
if (widget.controller.topic.isTopicVacuous) {
if (widget.controller.topic.mandatory) {
// The chosen topic can't be sent to, so don't show it.
return null;
}
}

return TopicName(widget.controller.topic.textNormalized);
}

@override
Widget build(BuildContext context) {
final store = PerAccountStoreWidget.of(context);
final zulipLocalizations = ZulipLocalizations.of(context);

final streamName = store.streams[widget.narrow.streamId]?.name
?? zulipLocalizations.unknownChannelName;
final topic = TopicName(widget.controller.topic.textNormalized);
final hintTopic = _hintTopic();
final hintDestination = hintTopic == null ?
// No i18n of this use of "#" and ">" string; those are part of how
// Zulip expresses channels and topics, not any normal English punctuation,
// so don't make sense to translate. See:
// https://github.com/zulip/zulip-flutter/pull/1148#discussion_r1941990585
'#$streamName' : '#$streamName > ${hintTopic.displayName}';

return _ContentInput(
narrow: widget.narrow,
destination: TopicNarrow(widget.narrow.streamId, topic),
destination: TopicNarrow(widget.narrow.streamId,
TopicName(widget.controller.topic.textNormalized)),
controller: widget.controller,
hintText: zulipLocalizations.composeBoxChannelContentHint(
// No i18n of this use of "#" and ">" string; those are part of how
// Zulip expresses channels and topics, not any normal English punctuation,
// so don't make sense to translate. See:
// https://github.com/zulip/zulip-flutter/pull/1148#discussion_r1941990585
'#$streamName > ${topic.displayName}'));
hintText: zulipLocalizations.composeBoxChannelContentHint(hintDestination));
}
}

Expand Down
Loading