-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigator 2.0 Remaining Work #65776
Comments
/cc @johnpryan @chunhtai |
In a discussion with @mdebbar, @yjbanov, and @chunhtai we decided to punt on #65777. We believe that if users really need to restore state, they can do so manually for now by adding stuff to the history entry (just like you can do in other web frameworks or native web as well, so this is not a regression in Flutter). If we receive feedback that people would like to see this done by the state restoration framework, we can revisit that decision and implement #65777 at a later point. At that point, we will also have to solve #33615. |
Had a conversation with @johnpryan , Our currently plan is to post a blog post about how to use the router widget, and there is no plan to provide opinionated class at this time. That means we will have a several code samples along with a tutorial blog post, and the stock app rewrite with the Router. @csells Is there anything else that is required to release the Router? |
@chunhtai is the Router approach going to be the recommended one? What about simple Pages API approach where we would just provide a list of pages to the Navigator. Would you also describe this in the blog post as an alternative? From the discussions with folks after the meetup people seem to feel much more comfortable with just Pages API. |
@orestesgaolin Yes we will recommend Router. In the case where developer only wants to use page API, we should make the Route information parsing in Router API optional. For example, something like this should work import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp.router(routerDelegate: MyRouterDelegate(),));
}
class MyRouterDelegate extends RouterDelegate<void> with ChangeNotifier, PopNavigatorRouterDelegateMixin {
@override
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
@override
Future<void> setNewRoutePath(void data) => Future<void>.value(null);
@override
Widget build(BuildContext context) {
return Navigator(
key: navigatorKey,
pages: <Page>[MaterialPage(builder: (BuildContext context) => Placeholder())],
onPopPage: (_,__) =>false,
);
}
} This is currently not working because the RouteInformationParser is a required parameter. We should probably update that. |
@orestesgaolin The main reason to use Router is to handle routes from the host platform. If you just want to have declarative navigation, then using the pages API alone should work. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Punted:
The text was updated successfully, but these errors were encountered: