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

套件詳情v1.2.3

morpheus

一個用於輕鬆實現 Material Design 導航過渡效果的 Flutter 套件。

近 30 天下載
107
喜歡數
37
Pub 分數
70

安裝套件

flutter pub add morpheus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Morpheus 是一個 Flutter 套件,旨在簡化 Material Design 實作導覽過渡。它提供直覺的 API,可建立流暢、一致且視覺上吸引人的路由過渡,符合 Material Design 指南。透過抽象複雜的動畫邏輯,讓開發者能以最少的程式碼提升使用者體驗。此套件支援與現有 Flutter 應用的無縫整合,並專注於開箱即用地提供精緻的導覽行為。

適用情境

  • 實現 Material Design 風格的頁面轉場
  • 透過流暢的動畫增強應用導航
  • 在各個螢幕之間新增一致的過渡行為
  • 提升行動應用的使用者體驗
  • 以最少的努力自定義路由過渡

主要特色

  • 內建的 Material Design 過渡範式
  • 用於常見導航動畫的簡單 API
  • 一致且可預測的過渡行為
  • 輕量且易於整合
  • 支援推入與彈出過渡

適合對象

  • Flutter 開發人員建構 Material Design 應用
  • 優先考慮使用者體驗的團隊,擁有順暢的導航
  • 需要標準化路線轉換的應用程式
  • 尋求快速過渡實現的開發人員
  • 專注於視覺美化和一致性

使用建議

  • 超出標準 Material 過渡之外的自定義功能有限
  • 不支援非 Material 設計系統
  • 可能需要額外的樣式設定以應對非標準用例
  • 未針對高度複雜或自訂動畫工作流程進行優化

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Morpheus

Pub Actions Status

A Flutter package for easily implementing Material Design navigation transitions.

Examples

Parent-child transition

You can use MorpheusPageRoute to create a parent-child transition between two screens.

Parent-child gif
import 'package:morpheus/morpheus.dart';

class MyList extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return ListView.builder(
      itemCount: 10,
      itemBuilder: (context, index) {
        final _parentKey = GlobalKey();
        return ListTile(
          key: _parentKey,
          leading: CircleAvatar(child: Text((index + 1).toString())),
          title: Text('Item ${index + 1}'),
          onTap: () => _handleTap(context, _parentKey),
        );
      }
    );
  }

  void _handleTap(BuildContext context, GlobalKey parentKey) {
    Navigator.of(context).push(MorpheusPageRoute(
      builder: (context) => Scaffold(),
      parentKey: parentKey,
    ));
  }

}
Top-level transition

You can use the MorpheusTabView widget to create a top-level transition when the child widget changes.

Top-level gif
import 'package:morpheus/morpheus.dart';

class MyTabScreen extends StatefulWidget {

  @override
  _MyTabScreenState createState() => _MyTabScreenState();

}

class _MyTabScreenState extends State<MyTabScreen> {

  final List<Widget> _screens = [
    Scaffold(backgroundColor: Colors.green),
    Scaffold(backgroundColor: Colors.red),
    Scaffold(backgroundColor: Colors.blue),
  ];
  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: MorpheusTabView(
        child: _screens[_currentIndex]
      ),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        items: [
          BottomNavigationBarItem(
            icon: Icon(Icons.trending_up),
            title: Text('Trending'),
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.star),
            title: Text('Saved'),
          ),
        ],
        onTap: (index) {
          if (index != _currentIndex) {
            setState(() => _currentIndex = index);
          }
        },
      ),
    );
  }

}

所屬分類

原始碼儲存庫

使用此套件的專案