搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.1

nuvigator

Flutter navigator 上強大的路由抽象,提供一些新功能以及定義路由器的簡單方式。

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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。