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

curved_navigation_bar 封面
插件详情v1.0.6

curved_navigation_bar

惊艳的动态弯曲形状导航栏。可调节颜色、背景色、动画曲线和动画持续时间。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.6万
喜欢数
2100
Pub 分数
160

安装插件

flutter pub add curved_navigation_bar

插件介绍

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

一个视觉上吸引人、带有动画效果的曲线导航栏,适用于Flutter应用。它提供可自定义的颜色、背景色调、动画曲线和持续时间设置,以创建动态且现代的底部导航体验。非常适合寻求独特、流畅界面并实现标签间平滑过渡的应用程序。该包支持Android、iOS、Web、macOS、Windows和Linux等多个平台。

适合场景

  • 自定义应用界面
  • 现代用户界面设计
  • 动画底部导航
  • 跨平台移动应用
  • 交互式标签切换
  • 增强的用户体验

主要特点

  • 可动画的曲线形状
  • 可自定义颜色
  • 可调节动画曲线
  • 可配置的动画持续时间
  • 多平台支持
  • 平滑过渡效果

适合对象

  • 注重设计的Flutter开发者
  • 需要唯一导航的应用程序
  • 具有现代UI美学的项目
  • 跨平台应用程序构建工具
  • 想要动画组件的开发者

使用建议

  • 可能会影响低端设备的性能
  • 超出视觉属性之外的自定义功能有限
  • 需要在各个平台上进行仔细测试
  • 动画可能不适合所有应用风格
  • 不太适合简单的导航需求

原始 README

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

curved_navigation_bar

pub package

A Flutter package for easy implementation of curved navigation bar.

Gif

Add dependency
dependencies:
  curved_navigation_bar: ^1.0.6 #latest version
Easy to use
Scaffold(
  bottomNavigationBar: CurvedNavigationBar(
    backgroundColor: Colors.blueAccent,
    items: <Widget>[
      Icon(Icons.add, size: 30),
      Icon(Icons.list, size: 30),
      Icon(Icons.compare_arrows, size: 30),
    ],
    onTap: (index) {
      //Handle button tap
    },
  ),
  body: Container(color: Colors.blueAccent),
)
Attributes

items: List of Widgets
index: index of NavigationBar, can be used to change current index or to set initial index
color: Color of NavigationBar, default Colors.white
buttonBackgroundColor: background color of floating button, default same as color attribute
backgroundColor: Color of NavigationBar's background, default Colors.blueAccent
onTap: Function handling taps on items
animationCurve: Curves interpolating button change animation, default Curves.easeOutCubic
animationDuration: Duration of button change animation, default Duration(milliseconds: 600)
height: Height of NavigationBar, min 0.0, max 75.0
maxWidth: Allows to set the width of the navigation bar lower than the entire screen width by default
letIndexChange: Function which takes page index as argument and returns bool. If function returns false then page is not changed on button tap. It returns true by default\

Change page programmatically
 //State class
  int _page = 0;
  GlobalKey<CurvedNavigationBarState> _bottomNavigationKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        bottomNavigationBar: CurvedNavigationBar(
          key: _bottomNavigationKey,
          items: <Widget>[
            Icon(Icons.add, size: 30),
            Icon(Icons.list, size: 30),
            Icon(Icons.compare_arrows, size: 30),
          ],
          onTap: (index) {
            setState(() {
              _page = index;
            });
          },
        ),
        body: Container(
          color: Colors.blueAccent,
          child: Center(
            child: Column(
              children: <Widget>[
                Text(_page.toString(), textScaleFactor: 10.0),
                ElevatedButton(
                  child: Text('Go To Page of index 1'),
                  onPressed: () {
                    //Page change using state does the same as clicking index 1 navigation button
                    final CurvedNavigationBarState? navBarState =
                        _bottomNavigationKey.currentState;
                    navBarState?.setPage(1);
                  },
                )
              ],
            ),
          ),
        ));
  }

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目