File tree Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ enum _HomePageTab {
3131class HomePage extends StatefulWidget {
3232 const HomePage ({super .key});
3333
34- static Route <void > buildRoute ({required int accountId}) {
34+ static AccountRoute <void > buildRoute ({required int accountId}) {
3535 return MaterialAccountWidgetRoute (accountId: accountId,
3636 loadingPlaceholderPage: _LoadingPlaceholderPage (accountId: accountId),
3737 page: const HomePage ());
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ abstract class MessageListPageState {
188188class MessageListPage extends StatefulWidget {
189189 const MessageListPage ({super .key, required this .initNarrow});
190190
191- static Route <void > buildRoute ({int ? accountId, BuildContext ? context,
191+ static AccountRoute <void > buildRoute ({int ? accountId, BuildContext ? context,
192192 required Narrow narrow}) {
193193 return MaterialAccountWidgetRoute (accountId: accountId, context: context,
194194 page: MessageListPage (initNarrow: narrow));
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ abstract class WidgetRoute<T extends Object?> extends PageRoute<T> {
3535 Widget get page;
3636}
3737
38+ /// A page route that specifies a particular Zulip account to use, by ID.
39+ abstract class AccountRoute <T extends Object ?> extends PageRoute <T > {
40+ /// The [Account.id] of the account to use for this page.
41+ int get accountId;
42+ }
43+
3844/// A [MaterialPageRoute] that always builds the same widget.
3945///
4046/// This is useful for making the route more transparent for a test to inspect.
@@ -56,8 +62,10 @@ class MaterialWidgetRoute<T extends Object?> extends MaterialPageRoute<T> implem
5662}
5763
5864/// A mixin for providing a given account's per-account store on a page route.
59- mixin AccountPageRouteMixin <T extends Object ?> on PageRoute <T > {
65+ mixin AccountPageRouteMixin <T extends Object ?> on PageRoute <T > implements AccountRoute <T > {
66+ @override
6067 int get accountId;
68+
6169 Widget ? get loadingPlaceholderPage;
6270
6371 @override
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ class ProfilePage extends StatelessWidget {
3030
3131 final int userId;
3232
33- static Route <void > buildRoute ({int ? accountId, BuildContext ? context,
33+ static AccountRoute <void > buildRoute ({int ? accountId, BuildContext ? context,
3434 required int userId}) {
3535 return MaterialAccountWidgetRoute (accountId: accountId, context: context,
3636 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>> {
66 Subject <Widget > get page => has ((x) => x.page, 'page' );
77}
88
9- extension AccountPageRouteMixinChecks <T > on Subject <AccountPageRouteMixin <T >> {
9+ extension AccountRouteChecks <T > on Subject <AccountRoute <T >> {
1010 Subject <int > get accountId => has ((x) => x.accountId, 'accountId' );
1111}
You can’t perform that action at this time.
0 commit comments