Skip to content

Commit 3fc5f19

Browse files
msglist [nfc]: Allow passing key in MessageListPage.buildRoute
This will be used soon to access `MessageListPageState` after routing to `MessageListPage`.
1 parent 57c39a7 commit 3fc5f19

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

lib/widgets/message_list.dart

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class MessageListTheme extends ThemeExtension<MessageListTheme> {
133133
/// The interface for the state of a [MessageListPage].
134134
///
135135
/// To obtain one of these, see [MessageListPage.ancestorOf].
136-
abstract class MessageListPageState {
136+
abstract class MessageListPageState extends State<MessageListPage> {
137137
/// The narrow for this page's message list.
138138
Narrow get narrow;
139139

@@ -171,11 +171,20 @@ class MessageListPage extends StatefulWidget {
171171
this.initAnchorMessageId,
172172
});
173173

174-
static AccountRoute<void> buildRoute({int? accountId, BuildContext? context,
175-
required Narrow narrow, int? initAnchorMessageId}) {
176-
return MaterialAccountWidgetRoute(accountId: accountId, context: context,
174+
static AccountRoute<void> buildRoute({
175+
GlobalKey<MessageListPageState>? key,
176+
int? accountId,
177+
BuildContext? context,
178+
required Narrow narrow,
179+
int? initAnchorMessageId,
180+
}) {
181+
return MaterialAccountWidgetRoute(
182+
accountId: accountId,
183+
context: context,
177184
page: MessageListPage(
178-
initNarrow: narrow, initAnchorMessageId: initAnchorMessageId));
185+
key: key,
186+
initNarrow: narrow,
187+
initAnchorMessageId: initAnchorMessageId));
179188
}
180189

181190
/// The "revealed" state of a message from a muted sender,

0 commit comments

Comments
 (0)