선택된 항목이 떨어지는 물방울처럼 시각적으로 강조되는 독특한 물방울 효과를 가진 하단 네비게이션 바입니다. Flutter 앱을 위한 것으로, 부드럽고 애니메이션 기반 피드백 메커니즘을 통해 사용자 상호작용을 향상시킵니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 크로스플랫폼 개발에 유연하게 활용할 수 있습니다. 가볍고 간단한 pub 명령어로 쉽게 통합할 수 있으며, 현대적이고 매력적인 탐색 경험을 원하는 앱에 적합합니다.
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.
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 WaterDropNavBarbackgroundColor. Check the example app. Like this 👇
returnAnnotatedRegion<SystemUiOverlayStyle>(
value: constSystemUiOverlayStyle(
//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.