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