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

GitHub 代码仓namanh11611/curved_labeled_navigation_bar

curved_labeled_navigation_bar

Flutter 中的动画曲线导航栏

curved_labeled_navigation_bar 项目封面
星标
18
复刻
24
最近推送(UTC)
2025年2月10日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

curved_labeled_navigation_bar

pub package

A Flutter package for easy implementation of curved navigation bar. This package is a fork of the original curved_navigation_bar from https://github.com/rafalbednarczuk/curved_navigation_bar with label for CurvedNavigationBarItem.

Label No Label
Gif Gif
Add dependency
dependencies:
  curved_labeled_navigation_bar: ^2.0.6 #latest version
Easy to use
Scaffold(
  bottomNavigationBar: CurvedNavigationBar(
    backgroundColor: Colors.blueAccent,
    items: [
      CurvedNavigationBarItem(
        child: Icon(Icons.home_outlined),
        label: 'Home',
      ),
      CurvedNavigationBarItem(
        child: Icon(Icons.search),
        label: 'Search',
      ),
      CurvedNavigationBarItem(
        child: Icon(Icons.chat_bubble_outline),
        label: 'Chat',
      ),
      CurvedNavigationBarItem(
        child: Icon(Icons.newspaper),
        label: 'Feed',
      ),
      CurvedNavigationBarItem(
        child: Icon(Icons.perm_identity),
        label: 'Personal',
      ),
    ],
    onTap: (index) {
      // Handle button tap
    },
  ),
  body: Container(color: Colors.blueAccent),
)
Attributes
CurvedNavigationBar
Attribute Description
items List of CurvedNavigationBarItem
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
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
animationCurve Curves interpolating button change animation, default Curves.easeOut
animationDuration Duration of button change animation, default Duration(milliseconds: 600)
height Height of NavigationBar
maxWidth Allows to set the width of the navigation bar lower than the entire screen width by default
iconPadding Padding of icon in floating button
CurvedNavigationBarItem
Attribute Description
child Icon of CurvedNavigationBarItem
label Text of CurvedNavigationBarItem
labelStyle TextStyle for label
Change page programmatically
 // State class
  int _page = 0;
  GlobalKey<CurvedNavigationBarState> _bottomNavigationKey = GlobalKey();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        bottomNavigationBar: CurvedNavigationBar(
          key: _bottomNavigationKey,
          items: [
            CurvedNavigationBarItem(
              child: Icon(Icons.home_outlined),
              label: 'Home',
            ),
            CurvedNavigationBarItem(
              child: Icon(Icons.search),
              label: 'Search',
            ),
            CurvedNavigationBarItem(
              child: Icon(Icons.chat_bubble_outline),
              label: 'Chat',
            ),
            CurvedNavigationBarItem(
              child: Icon(Icons.newspaper),
              label: 'Feed',
            ),
            CurvedNavigationBarItem(
              child: Icon(Icons.perm_identity),
              label: 'Personal',
            ),
          ],
          onTap: (index) {
            setState(() {
              _page = index;
            });
          },
        ),
        body: Container(
          color: Colors.blueAccent,
          child: Center(
            child: Column(
              children: <Widget>[
                Text(_page.toString(), textScaler: TextScaler.linear(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);
                  },
                )
              ],
            ),
          ),
        ),
    );
  }
Nam Anh Nguyen GitHub avatar
GitHub 作者

Nam Anh Nguyen ↗

Software Engineer

Hanoi
语言DartCMakeC++HTMLCSwiftKotlinObjective-C

此仓库发布的插件

使用的依赖

依赖清单 4 项

  • flutter{"sdk":"flutter"}
  • meta^1.2.4
  • universal_io^2.2.2
  • flutter_test开发依赖{"sdk":"flutter"}

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗