@@ -11,6 +11,7 @@ import '../model/store.dart';
11
11
import 'action_sheet.dart' ;
12
12
import 'compose_box.dart' ;
13
13
import 'content.dart' ;
14
+ import 'icons.dart' ;
14
15
import 'page.dart' ;
15
16
import 'sticky_header.dart' ;
16
17
import 'store.dart' ;
@@ -70,6 +71,27 @@ class MessageListAppBarTitle extends StatelessWidget {
70
71
71
72
final Narrow narrow;
72
73
74
+ Widget _buildStreamRow (ZulipStream ? stream, String text) {
75
+ final icon = switch (stream) {
76
+ ZulipStream (isWebPublic: true ) => ZulipIcons .globe,
77
+ ZulipStream (inviteOnly: true ) => ZulipIcons .lock,
78
+ ZulipStream () => ZulipIcons .hash_sign,
79
+ null => null , // A null [Icon.icon] makes a blank space.
80
+ };
81
+ return Row (
82
+ mainAxisSize: MainAxisSize .min,
83
+ crossAxisAlignment: CrossAxisAlignment .baseline,
84
+ textBaseline: TextBaseline .alphabetic,
85
+ children: [
86
+ Padding (
87
+ // TODO(design): The vertical alignment of the stream privacy icon is ad hoc and eyeballed.
88
+ padding: const EdgeInsets .only (bottom: 4 ),
89
+ child: Icon (size: 16 , icon)),
90
+ const SizedBox (width: 8 ),
91
+ Text (text),
92
+ ]);
93
+ }
94
+
73
95
@override
74
96
Widget build (BuildContext context) {
75
97
switch (narrow) {
@@ -78,13 +100,15 @@ class MessageListAppBarTitle extends StatelessWidget {
78
100
79
101
case StreamNarrow (: var streamId):
80
102
final store = PerAccountStoreWidget .of (context);
81
- final streamName = store.streams[streamId]? .name ?? '(unknown stream)' ;
82
- return Text ("#$streamName " ); // TODO show stream privacy icon
103
+ final stream = store.streams[streamId];
104
+ final streamName = stream? .name ?? '(unknown stream)' ;
105
+ return _buildStreamRow (stream, streamName);
83
106
84
107
case TopicNarrow (: var streamId, : var topic):
85
108
final store = PerAccountStoreWidget .of (context);
86
- final streamName = store.streams[streamId]? .name ?? '(unknown stream)' ;
87
- return Text ("#$streamName > $topic " ); // TODO show stream privacy icon; format on two lines
109
+ final stream = store.streams[streamId];
110
+ final streamName = stream? .name ?? '(unknown stream)' ;
111
+ return _buildStreamRow (stream, "$streamName > $topic " );
88
112
89
113
case DmNarrow (: var otherRecipientIds):
90
114
final store = PerAccountStoreWidget .of (context);
0 commit comments