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 @@ -11,6 +11,12 @@ abstract class WidgetRoute<T extends Object?> extends PageRoute<T> {
1111Widget  get  page;
1212}
1313
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+ 
1420/// A [MaterialPageRoute]  that always builds the same widget. 
1521/// 
1622/// 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
3238}
3339
3440/// 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 
3643  int  get  accountId;
44+ 
3745  Widget ?  get  loadingPlaceholderPage;
3846
3947  @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