Skip to content

Commit c1fe04b

Browse files
committed
msglist: AppBars for subscribed streams use subscription color
1 parent fc7400e commit c1fe04b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lib/widgets/message_list.dart

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,30 @@ class MessageListPage extends StatefulWidget {
4646
State<MessageListPage> createState() => _MessageListPageState();
4747
}
4848

49+
const _kFallbackStreamColor = Color(0xfff5f5f5);
50+
4951
class _MessageListPageState extends State<MessageListPage> {
5052
final GlobalKey<ComposeBoxController> _composeBoxKey = GlobalKey();
5153

5254
@override
5355
Widget build(BuildContext context) {
56+
final store = PerAccountStoreWidget.of(context);
57+
58+
final Color backgroundColor;
59+
switch(widget.narrow) {
60+
case AllMessagesNarrow():
61+
backgroundColor = _kFallbackStreamColor;
62+
case StreamNarrow(:final streamId):
63+
case TopicNarrow(:final streamId):
64+
backgroundColor = store.subscriptions[streamId]?.colorSwatch().barBackground
65+
?? _kFallbackStreamColor;
66+
case DmNarrow():
67+
backgroundColor = _kFallbackStreamColor;
68+
}
69+
5470
return Scaffold(
55-
appBar: AppBar(title: MessageListAppBarTitle(narrow: widget.narrow)),
71+
appBar: AppBar(title: MessageListAppBarTitle(narrow: widget.narrow),
72+
backgroundColor: backgroundColor),
5673
// TODO question for Vlad: for a stream view, should we set
5774
// [backgroundColor] based on stream color, as in this frame:
5875
// https://www.figma.com/file/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=132%3A9684&mode=dev

0 commit comments

Comments
 (0)