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

water_drop_nav_bar 封面
套件詳情v2.2.2

water_drop_nav_bar

底部導航欄,具有獨特的水滴效果。當水滴落下時,會標記選中的項目。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
321
喜歡數
400
Pub 分數
160

安裝套件

flutter pub add water_drop_nav_bar

套件介紹

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

一個帶有獨特水滴效果的底部導航欄,視覺上強調選中的項目,彷彿水滴落下一般。專為Flutter應用設計,透過流暢的動畫回饋機制提升使用者互動體驗。該套件支援Android、iOS、Web、macOS、Windows及Linux等多個平台,適用於跨平台開發。輕量級且易於整合,僅需簡單的pub指令即可完成。非常適合追求現代、生動導航體驗的應用。

適用情境

  • 行動應用程式導航
  • 跨平台應用程式
  • 互動式使用者介面元件
  • 現代設計介面
  • 使用者參與功能

主要特色

  • 水滴動畫效果
  • 平滑選擇反饋
  • 多平台支援
  • 透過 pub 輕鬆整合
  • 可自定外觀
  • 輕量且高效

適合對象

  • Flutter 開發者
  • 注重設計的應用程式
  • 使用者互動高的應用
  • 現代UI/UX專案
  • 跨平台移動開發

使用建議

  • 可能影響低階裝置的效能
  • 動畫的自訂選項有限
  • 不適合極簡設計
  • 需要仔細的顏色協調
  • 動畫可能會在某些情境下分散使用者的注意力

原始 README

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

Water Drop Nav Bar

YouTube Badge Twitter Badge Patreon Badge pub package WateryDesert


Design Credit & screen recording

Animated Tabbar by Cuberto

How to use?

Installation

Add water_drop_nav_bar: to your pubspec.yaml dependencies then run flutter pub get

 dependencies:
  water_drop_nav_bar:
Import

Add this line to import the package.

import 'package:water_drop_nav_bar/water_drop_nav_bar.dart';

Add WaterDropNavBar() as bottomNavigationBar of Scaffold() and body would be PageView() with NeverScrollableScrollPhysics() don't try to upate the seleted index from onPageChanged or will see some weird behaviour. Insted of PageView() You can use Stack() or AnimatedSwitcher for custom page transition animation.

API Reference

barItems → List<BarItem>

  • List of bar items that shows horizontally, Minimum 2 and maximum 4 items.
    required

onItemSelected → OnButtonPressCallback

  • Callback When individual barItem is pressed.
    required

selectedIndex → int

  • Current selected index of the bar item.
    required

backgroundColor → Color

  • Background Color of the bar.
    optional [Colors.white]

waterDropColor → Color

  • Color of water drop which is also the active icon color.
    optional [Color(0xFF5B75F0)]

inactiveIconColor → Color

  • Inactive icon color by default it will use water drop color.
    optional [waterDropColor]

iconSize → double

  • Each active & inactive icon size, default value is 28 don't make it too big or small.
    optional [28]

bottomPadding → double

  • Additional padding at the bottom of the bar. If nothing is provided the it will use [MediaQuery.of(context).padding.bottom] value.
    optional
Do and don't
  • Don't make icon size too big.
  • Use complementary filled and outlined icons for best result.
  • backgroundColor and waterDropColor of WaterDropNavBar() and Scaffold()'s backgroundColor (or whatever widget you are using) must be different (see the example app) This will visualize that the water drop is hanging from the top.
Short example
 return Scaffold(
     
      body: PageView(
      physics: NeverScrollableScrollPhysics(),       
      controller: pageController,
       ...
      ),
      bottomNavigationBar: WaterDropNavBar(
        backgroundColor: Colors.white,
        onItemSelected: (index) {
          setState(() {
            selectedIndex = index;
          });
          pageController.animateToPage(selectedIndex,
              duration: const Duration(milliseconds: 400),
              curve: Curves.easeOutQuad);
        },
        selectedIndex: selectedIndex,
        barItems: [
          BarItem(
            filledIcon: Icons.bookmark_rounded,
            outlinedIcon: Icons.bookmark_border_rounded,
          ),
          BarItem(
              filledIcon: Icons.favorite_rounded,
              outlinedIcon: Icons.favorite_border_rounded),
        ],
      ),
    );

Issues ❗️

Android

Some android phones might have black navigation bar, this looks ugly. It's recommended to wrap Scaffold with AnnotatedRegion<SystemUiOverlayStyle> to change that black navigation bar color to WaterDropNavBar backgroundColor. Check the example app. Like this 👇

return AnnotatedRegion<SystemUiOverlayStyle>(
     value: const SystemUiOverlayStyle(
       //this color must be equal to the WaterDropNavBar backgroundColor
       systemNavigationBarColor: Colors.white, 
       systemNavigationBarIconBrightness: Brightness.dark,
     ),
     child: Scaffold(
       body: // code here
     )
);

result 👇


You can additionally provide some bottomPadding to add padding at the bottom of the bar, I think 8 is enough.

iPhone

iPhones without swipe home gesture might have such issue where icons are pushed to the bottom. Provide some bottomPadding. I added 8 padding here.

result 👇

Now you might ask how do you know which phone is using swipe home gesture?

Well, you can check bottom padding (using MediaQuery.of(context).padding.bottom) and if it's less than 34 or something then provide some bottom padding. Definitely try running different simulators and see.

FAQ

  • How do I change the height?

The height must be constant because the animation is in vertical direction. According to me 60 is perfect. But if you think needs to be reduced then please create an issue with a screenshot. I will see if I can do something.

  • How do I add drop shadow?

Wrap WaterDropNavBar with DecoratedBox or Container and pass BoxDecoration to decoration property. BoxDecoration takes list of boxShadow there you can pass your drop shadow.

DecoratedBox(
    decoration: BoxDecoration(
      boxShadow: [
        BoxShadow(
            color: Colors.black.withOpacity(0.2),
            offset: Offset(0, 4),
            blurRadius: 8.0)
      ],
    ),
    child: WaterDropNavBar()
)
  • How do I change the corner radius of the navigation bar?

Wrap WaterDropNavBar with ClipRRect and pass BorderRadius to borderRadius property.

  ClipRRect(
      borderRadius: const BorderRadius.vertical(
        top: Radius.circular(16),
      ),
      child: WaterDropNavBar(
    )                

All flutter packages

● Sliding Clipped Nav Bar
➜ Water Drop Nav Bar
● Swipeable Tile
● Loading Animation Widget


所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。