Skip to content

Commit a252427

Browse files
committed
msglist [nfc]: Add MessageListView to MessageListPageState
This will make it available in a long-press handler in the app bar for a topic narrow. That long-press handler brings up the topic action sheet, which will need a message ID to pass in the API request for resolve/unresolve topic. (Not sure the API request should *need* to require a message ID, but it does; shrug.)
1 parent fc707c3 commit a252427

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/widgets/message_list.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ abstract class MessageListPageState {
180180
/// if this [MessageListPage] offers a compose box and it has mounted,
181181
/// else null.
182182
ComposeBoxController? get composeBoxController;
183+
184+
/// The active [MessageListView].
185+
///
186+
/// This is null if [MessageList] has not mounted yet.
187+
MessageListView? get model;
183188
}
184189

185190
class MessageListPage extends StatefulWidget {
@@ -215,9 +220,12 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
215220

216221
@override
217222
ComposeBoxController? get composeBoxController => _composeBoxKey.currentState?.controller;
218-
219223
final GlobalKey<ComposeBoxState> _composeBoxKey = GlobalKey();
220224

225+
@override
226+
MessageListView? get model => _messageListKey.currentState?.model;
227+
final GlobalKey<_MessageListState> _messageListKey = GlobalKey();
228+
221229
@override
222230
void initState() {
223231
super.initState();
@@ -303,7 +311,11 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
303311
removeBottom: ComposeBox.hasComposeBox(narrow),
304312

305313
child: Expanded(
306-
child: MessageList(narrow: narrow, onNarrowChanged: _narrowChanged))),
314+
child: MessageList(
315+
key: _messageListKey,
316+
narrow: narrow,
317+
onNarrowChanged: _narrowChanged,
318+
))),
307319
if (ComposeBox.hasComposeBox(narrow))
308320
ComposeBox(key: _composeBoxKey, narrow: narrow)
309321
]))));

0 commit comments

Comments
 (0)