Skip to content

clarify widgetsapp docs#24090

Merged
dnfield merged 3 commits intoflutter:masterfrom
dnfield:app_docs
Nov 8, 2018
Merged

clarify widgetsapp docs#24090
dnfield merged 3 commits intoflutter:masterfrom
dnfield:app_docs

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Nov 8, 2018

Per feedback from @xster

/cc @HansMuller

/// If [home] or [routes] are not null, the routing implementation needs to know how
/// appropriately build [PageRoutes]. This can be achieved by supplying the
/// [pageRouteBuilder] parameter or the [builder] parameter, or both. The
/// [pageRouteBuilder] is more appropriate if you will only be building [Route]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're also not really at the same level of decision no? The pageRouteBuilder is fed into the _onGenerateRoute when building individual routes. The builder is outside the route and outside the navigator altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As implemented, pageRouteBuilder will get ignored if builder is specified - that may be wrong, but it's how it is. Maybe it's be more appropriate to say the routing implementation needs to know how to appropriately build a new widget when routing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds unexpected. Perhaps you're referring to https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/app.dart#L646? (in that case we should probably rename the similarly named local variable).

I also meant we should clarify what the choice the user is to make (which are at different scales of 'complexity'). If you override pageRouteBuilder, given the page content builder that the user already provided, decorate it with a route. If you override builder, you're building everything. That difference in scale should be described.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh you are absolutely right. I'll update the doc and rename the local there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it should be pageContentBuilder or something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overriding builder doens't really mean overriding everything though - builder gets passed a child, it's meant to just be a wrapper around whatever we'd be doing normally.

@xster
Copy link
Member

xster commented Nov 8, 2018

LGTM

@dnfield dnfield merged commit 9430906 into flutter:master Nov 8, 2018
@dnfield dnfield deleted the app_docs branch November 9, 2018 23:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants