パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.3.0

custom_navigator

ウィジェットツリーの任意の場所で独自のナビゲーターを作成しやすくするFlutterパッケージです。

30日間ダウンロード
107
いいね数
51
Pub ポイント
40

パッケージをインストール

flutter pub add custom_navigator

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterパッケージで、ウィジェットツリーの任意の部分にカスタムナビゲーターを作成することを簡素化します。アプリのメインナビゲーターとは独立してナビゲーションロジックを定義・管理できるため、モジュール化され再利用可能なナビゲーションコンポーネントが可能になります。ネストされたまたは動的なナビゲーションフローを持つ複雑なUIに最適で、関心の分離を促進し、テスト性を高めます。このパッケージは軽量であり、アプリのコア構造への深い統合を必要とせずに柔軟性を備えています。

用途

  • 大規模なアプリにおけるモジュール型ナビゲーションの構築
  • ウィジェット内のネストされたナビゲーションを作成する
  • 動的ルート管理の実装
  • 再利用可能なナビゲーションコンポーネントの有効化
  • 独立したナビゲーションロジックのテスト

主な機能

  • ウィジェットツリーのどこにでも簡単に統合
  • カスタムルート定義をサポートしています
  • 再利用可能なナビゲーションロジックを促進する
  • 最小限のボイラープレート
  • メインナビゲーターとは独立して動作します

適している対象

  • 複雑なナビゲーションパターンを構築する開発者
  • モジュール式UIアーキテクチャを必要とするチーム
  • 動的またはネストされたナビゲーションを持つアプリ
  • テスト駆動開発ワークフロー
  • 内部ナビゲーションを必要とするカスタムUIコンポーネント

注意事項

  • MaterialApp.router の代替として意図されていません
  • 複数のコンテキストで使用する場合、状態管理に注意が必要です
  • シンプルなアプリで過剰に使用すると、複雑さが増す可能性があります
  • 組み込みナビゲーターと比較して、プラットフォーム固有の機能が限られている

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Custom navigator

A flutter package that makes it easy to create your own navigator anywhere in the widget tree.

A common use for such widget is when you need to implement an "Always presenting bottom navigation bar"

Getting Started

First you need to add the package to your pubspec.yaml file.

Custom scaffold

CustomScaffold is a stateful widget that uses the CustomNavigator to to handle item transition of [BottomNavigationBar] with nested navigation while keeping the [BottomNavigationBar] visible!

Usage
// Here's the custom scaffold widget
// It takes a normal scaffold with mandatory bottom navigation bar
// and children who are your pages
CustomScaffold(
      scaffold: Scaffold(
        bottomNavigationBar: BottomNavigationBar(
          items: _items,
        ),
      ),

      // Children are the pages that will be shown by every click
      // They should placed in order such as
      // `page 0` will be presented when `item 0` in the [BottomNavigationBar] clicked.
      children: <Widget>[
        Page('0'),
        Page('1'),
        Page('2'),
      ],

      // Called when one of the [items] is tapped.
      onItemTap: (index) {},
    );

See the custom_scaffold_example for more details


Custom navigator

The CustomNavigator is fairly easy to use

Usage

CustomNavigator(
        home: YourChildWidget(),
        //Specify your page route [PageRoutes.materialPageRoute] or [PageRoutes.cupertinoPageRoute]
        pageRoute: PageRoutes.materialPageRoute,
      );

Then you can call it using the same old Navigator.of(context)

Options
  • you can specify Named routes exactly like in MaterialApp.

if you want to use the default [Navigator] you need to specify a [GlobalKey] to your [MaterialApp] and use it navigatorKey.currentState

See the example for more details.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト