{"id":15436157,"url":"https://github.com/fluttercandies/nav_router","last_synced_at":"2025-04-11T03:39:25.946Z","repository":{"id":53543536,"uuid":"225752027","full_name":"fluttercandies/nav_router","owner":"fluttercandies","description":"flutter The lightest, easiest and most convenient route management!","archived":false,"fork":false,"pushed_at":"2024-06-24T10:13:49.000Z","size":8555,"stargazers_count":103,"open_issues_count":3,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-25T01:41:25.317Z","etag":null,"topics":["flutter","flutter-plugin","flutter-widget"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercandies.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-04T01:29:01.000Z","updated_at":"2024-06-24T10:13:53.000Z","dependencies_parsed_at":"2024-06-24T11:38:59.011Z","dependency_job_id":"2a7cb181-f2bf-43b4-afcd-60bbf1e92f3e","html_url":"https://github.com/fluttercandies/nav_router","commit_stats":{"total_commits":110,"total_committers":4,"mean_commits":27.5,"dds":0.07272727272727275,"last_synced_commit":"8b4b8ef08ba57e93a26ba1c81ec133f4dd95209f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fnav_router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fnav_router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fnav_router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fnav_router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercandies","download_url":"https://codeload.github.com/fluttercandies/nav_router/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248338886,"owners_count":21087210,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","flutter-plugin","flutter-widget"],"created_at":"2024-10-01T18:48:44.445Z","updated_at":"2025-04-11T03:39:25.890Z","avatar_url":"https://github.com/fluttercandies.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"Language: [English](README.md) | [中文简体](README_ZH.md)\n\n[![GitHub stars](https://img.shields.io/github/stars/fluttercandies/nav_router)](https://github.com/fluttercandies/nav_router/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/fluttercandies/nav_router)](https://github.com/fluttercandies/nav_router/network)\n[![GitHub issues](https://img.shields.io/github/issues/fluttercandies/nav_router)](https://github.com/fluttercandies/nav_router/issues) \n\n# nav_router\n\nnav_router is the simplest / lightweight / convenient routing management solution for flutter. It supports various routing animations, and it is very convenient to jump / pass parameters. To jump to a new page, just routePush (NewPage ());\n\n# Log\n* 2021.03.25 - Migrating to `nullSafety`\n\n* 2020.07.04 - Test Flutter 1.17.3\n\n* 2020.06.03 - Cancel pop default empty string data\n\n* 2020.02.28 - Fix pop method of dev branch flutter error.\n\n## Getting started\n\n### Add dependency\n```yaml\ndependencies:\n  nav_router: ^1.0.0\n```\n\n\u003e Related articles updated ...\n\nThen use `flutter packages upgrade` to update flutter plugin packages\n\n# Sample project\n\nThere is a pretty sweet example project in the example folder. Check it out. Otherwise, keep reading to get up and running.\n\n# Setting up\n*  1.Import our plugin on the page of `MaterialApp`\n```dart\nimport 'package:nav_router/nav_router.dart';\n```\n*  2.Write `navGK` value in` navigatorKey` property of `MaterialApp`\n```dart\n  Widget build(BuildContext context) {\n    return new MaterialApp(\n      title: '',\n      navigatorKey: navGK,\n    );\n  }\n```\n* 3.Then, we can start using it, here is an example of a jump page\n```dart\nWidget buildItem(RouteModel item) {\n  return new FlatButton(\n    onPressed: () =\u003e routePush(new NewPage()),\n    child: new Text('Click to jump'),\n  );\n}\n```\n\n* 4.If we want to use other routing animations to jump, we can add jump properties later, such as: gradient animation\n```dart\nroutePush(new NewPage(), RouterType.fade);\n```\n\n\n# Parameter passing\n\n## Way 1：\nNormally push the new page, but add Then at the back, the v behind is the data brought back by the page after we jump, and then we print it out.\n```dart\nroutePush(NewPage()).then((v) {\n  print('I received::$v');\n});\n```\nThen our new page will pop the return value. Add our parameters directly in the pop and then the brackets. It can be any type of parameter value. After that, what we wrote above will receive the parameters we returned this time with the past.\n```dart\nFlatButton(\n  onPressed: () {\n    pop('This is the parameter');\n  },\n  child: Text('Return with parameters'),\n),\n```\n\n## Way 2：\nMethod two can use our NavData, first add the NavData type parameter to the page we want to push to,\n```dart\nclass NewPage extends StatlessWidget {\n  final NavData navData;\n\n  NewPage({this.navData});\n}\n```\nThen the following judges whether the navData is empty, that is, whether the superior has received this method, and if so, returns it with parameters.\n```dart\nFlatButton(\n  onPressed: () {\n    if(navData == null) return;\n    widget.navData('NavData mode parameter transmission');\n    pop();\n  },\n  child: Text('Return with parameters'),\n),\n```\nThen the place where we push can use navData to receive the value and print it out.\n```dart\nroutePush(NewPage(navData: (v) {\n    print('I received::$v');\n  }),\n);\n```\n\n# Effect map [图片不能显示点我](http://img.flutterj.com/nav_router/)\n|![1.gif](git/1.gif)| ![2.gif](git/2.gif) | ![3.gif](git/3.gif)|\n| --- | --- | --- |\n|![4.gif](git/4.gif)| ![5.gif](git/5.gif) | ![6.gif](git/6.gif)|\n|![7.gif](git/7.gif)| ![8.gif](git/8.gif) | ![9.gif](git/9.gif)|\n|![10.gif](git/10.gif)| ![11.gif](git/11.gif) | ![12.gif](git/12.gif)|\n\n# Flutter WeChat group\n\n\u003cimg src=\"git/left_group.png\" height=\"200\" width=\"200\" style=\"zoom:30%;\" /\u003e\n\n[Above can't show my point](git/left_group.png)\n\nFlutterJ：www.flutterj.com\n\n# Contributor\n\n* author: crazyQ1 [https://github.com/ahyangnb](https://github.com/ahyangnb)\n* migrator: dwikyhardi [github.com/dwikyhardi](github.com/dwikyhardi)\n\n### LICENSE\n```\nfluttercandies/nav_router is licensed under the\nApache License 2.0\n\nA permissive license whose main conditions require preservation of copyright and license notices. \nContributors provide an express grant of patent rights. \nLicensed works, modifications, and larger works may be distributed under different terms and without source code.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fnav_router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercandies%2Fnav_router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fnav_router/lists"}