搜索插件、代码仓与 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);
          }
        },
      ),
    );
  }

}

所属分类

源码仓库

使用此插件的项目