搜索插件、代码仓与 APP 分类

插件详情v2.0.1

nuvigator

Flutter 导航器的强大路由抽象,提供了一些新功能,并且可以轻松定义路由器。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
4.9万
喜欢数
50
Pub 分数
140

安装插件

flutter pub add nuvigator

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Nuvigator 是 Flutter 的路由抽象,它通过额外的功能增强了内置的 Navigator,并以简化且声明式的方式定义导航路由。它提供了一种清晰、可扩展的方法,用于在 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台上管理应用导航。通过提供结构化的路由器配置和改进的导航处理,Nuvigator 帮助开发者以更少的样板代码和更高的可维护性构建复杂的导航流程。

适合场景

  • 复杂的导航流程
  • 跨平台导航
  • 模块化应用架构
  • 轻松的路线管理
  • 导航状态持久化

主要特点

  • 声明式路由定义
  • 多平台支持
  • 导航状态管理
  • 可扩展的路由器系统
  • 关注点的清晰分离

适合对象

  • 大规模的 Flutter 应用
  • 需要一致导航模式的团队
  • 需要高级路由逻辑的应用程序
  • 寻求减少导航样板代码的开发者
  • 面向多个平台的项目

使用建议

  • 新用户的上手曲线
  • 简单应用中的潜在开销
  • 需要理解路由概念
  • 与原生导航器相比,社区采用有限
  • 可能需要自定义设置以应对高级用例

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Nuvigator

CircleCI Pub

Routing and Navigation package.

Não fala bem inglês? Leia o README_PT

What

Nuvigator provides a powerful routing abstraction over Flutter's own Navigators. Model complex navigation flows using a mostly declarative and concise approach, without needing to worry about several tricky behaviors that Nuvigator handles for you.

Nuvigator can help you with:

  • Large/Modular Apps: Where you need to have an unified API to able to register routes and design relationship between them
  • Nested Navigation: When you want to have nested/children Navigator inside your app, creating the concept of self contained flows
    • Handles Navigation thought Nuvigator ins your Widget Tree, not need to know where your route is declared
    • Handles pop behavior when a nested Navigator reaches it's end, is able to transparently forward pop results into underlying caller, provider helpers to deal with nested navigation
    • Handles Hero animation/transition between nested Navigators
    • Handles Android back button correctly on nested Navigators
    • Improve support for nested PageRoutes with NuvigatorPageRoute mixin
  • Using DeepLinks: You want to navigate inside your App using DeepLinks, with support for Path Parameters and Query Parameters
  • A declarative, easy to use API to declare and compose Routes together

API Documentation

Focus on providing a more flexible, easier and dynamic API for declaring Navigation and Routing

Quick Start

The simplest you can get:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Nuvigator App',
      builder: Nuvigator.routes(
        initialRoute: 'home',
        screenType: materialScreenType,
        routes: [
          NuRouteBuilder(path: 'home', builder: (_, __, ___) => HomeScreen()),
          NuRouteBuilder(path: 'second', builder: (_, __, ___) => SecondScreen()),
        ],
      ),
    );
  }
}

A more complete example:

import 'package:nuvigator/next.dart'; // import the next file instead of `nuvigator.dart`
import 'package:flutter/material.dart';

// Define a new NuRoute
class MyRoute extends NuRoute {
  @override
  String get path => 'my-route';

  @override
  ScreenType get screenType => materialScreenType;

  @override
  Widget build(BuildContext context, NuRouteSettings settings) {
    return MyScreen(
      onClick: () => nuvigator.open('next-route'),
    );
  }
}

// Define your NuRouter
class MyRouter extends NuRouter {
  @override
  String get initialRoute => 'my-route';

  @override
  List<NuRoute> get registerRoutes => [
    MyRoute(),
  ];
}

// Render
Widget build(BuildContext context) {
  return Nuvigator(
    router: MyRouter(),
  );
}

License

Apache License 2.0

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。