Skip to content
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

Closed
4 of 6 tasks
goderbauer opened this issue Sep 14, 2020 · 7 comments
Closed
4 of 6 tasks

Navigator 2.0 Remaining Work #65776

goderbauer opened this issue Sep 14, 2020 · 7 comments
Labels
f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels.

Comments

@goderbauer
Copy link
Member

goderbauer commented Sep 14, 2020

Punted:

@goderbauer goderbauer added framework flutter/packages/flutter repository. See also f: labels. f: routes Navigator, Router, and related APIs. labels Sep 14, 2020
@goderbauer
Copy link
Member Author

/cc @johnpryan @chunhtai

@goderbauer
Copy link
Member Author

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.

@chunhtai
Copy link
Contributor

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?

@orestesgaolin
Copy link
Contributor

@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.

@chunhtai
Copy link
Contributor

@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.

@johnpryan
Copy link
Contributor

@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.

@github-actions
Copy link

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 flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: routes Navigator, Router, and related APIs. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

No branches or pull requests

5 participants