File tree 5 files changed +13
-5
lines changed
5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ enum _HomePageTab {
31
31
class HomePage extends StatefulWidget {
32
32
const HomePage ({super .key});
33
33
34
- static Route <void > buildRoute ({required int accountId}) {
34
+ static AccountRoute <void > buildRoute ({required int accountId}) {
35
35
return MaterialAccountWidgetRoute (accountId: accountId,
36
36
loadingPlaceholderPage: _LoadingPlaceholderPage (accountId: accountId),
37
37
page: const HomePage ());
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ abstract class MessageListPageState {
188
188
class MessageListPage extends StatefulWidget {
189
189
const MessageListPage ({super .key, required this .initNarrow});
190
190
191
- static Route <void > buildRoute ({int ? accountId, BuildContext ? context,
191
+ static AccountRoute <void > buildRoute ({int ? accountId, BuildContext ? context,
192
192
required Narrow narrow}) {
193
193
return MaterialAccountWidgetRoute (accountId: accountId, context: context,
194
194
page: MessageListPage (initNarrow: narrow));
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ abstract class WidgetRoute<T extends Object?> extends PageRoute<T> {
11
11
Widget get page;
12
12
}
13
13
14
+ /// A page route that specifies a particular Zulip account to use, by ID.
15
+ abstract class AccountRoute <T extends Object ?> extends PageRoute <T > {
16
+ /// The [Account.id] of the account to use for this page.
17
+ int get accountId;
18
+ }
19
+
14
20
/// A [MaterialPageRoute] that always builds the same widget.
15
21
///
16
22
/// This is useful for making the route more transparent for a test to inspect.
@@ -32,8 +38,10 @@ class MaterialWidgetRoute<T extends Object?> extends MaterialPageRoute<T> implem
32
38
}
33
39
34
40
/// A mixin for providing a given account's per-account store on a page route.
35
- mixin AccountPageRouteMixin <T extends Object ?> on PageRoute <T > {
41
+ mixin AccountPageRouteMixin <T extends Object ?> on PageRoute <T > implements AccountRoute <T > {
42
+ @override
36
43
int get accountId;
44
+
37
45
Widget ? get loadingPlaceholderPage;
38
46
39
47
@override
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class ProfilePage extends StatelessWidget {
30
30
31
31
final int userId;
32
32
33
- static Route <void > buildRoute ({int ? accountId, BuildContext ? context,
33
+ static AccountRoute <void > buildRoute ({int ? accountId, BuildContext ? context,
34
34
required int userId}) {
35
35
return MaterialAccountWidgetRoute (accountId: accountId, context: context,
36
36
page: ProfilePage (userId: userId));
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ extension WidgetRouteChecks<T> on Subject<WidgetRoute<T>> {
6
6
Subject <Widget > get page => has ((x) => x.page, 'page' );
7
7
}
8
8
9
- extension AccountPageRouteMixinChecks <T > on Subject <AccountPageRouteMixin <T >> {
9
+ extension AccountRouteChecks <T > on Subject <AccountRoute <T >> {
10
10
Subject <int > get accountId => has ((x) => x.accountId, 'accountId' );
11
11
}
You can’t perform that action at this time.
0 commit comments