一個視覺上吸引人的底端導航列,具備流暢的動畫效果。它允許完全自訂欄位的顏色、圖示與動畫速度,非常適合現代且動態的使用者介面。設計著重於美學與回應性,支援包括 Android、iOS、Web、macOS、Windows 及 Linux 在內的多個平台。此套件透過符合觸控互動的細膩且引人入勝的轉場效果來提升使用者體驗。其輕量級特性與易於整合的優點,使它適用於希望以精緻 UI 元素脫穎而出的應用程式。
適用情境
行動應用程式導航
Web 應用程式儀表板
跨平台UI設計
互動式原型
現代應用程式介面
主要特色
流體動畫效果
可自定顏色
可調節的動畫速度
圖示自訂
多平台支援
流暢的觸控回應
適合對象
注重設計的開發者
具有動態 UI 的應用
Flutter 專案尋求視覺魅力
開發者優先考慮使用者體驗
針對多個平台的專案
使用建議
可能影響低階裝置的效能
需要仔細調整動畫速度
僅限底部導航使用情境
不太適合極簡設計
取決於一致的圖示集使用
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Fluid Navigation Bar
Many thanks to gskinner for "The vignettes" showcase presented at Flutter Interact '19 :
They created an awesome creative experience and most of the code in this package comes from
their realisation. I was really impressed by their huge work but the code, even if it was open-sourced,
was not usable as it. So I did some refactoring for maintainability, I extracted some
fields to be able to adapt and skin the widget according to our design and decided to share it.
Enjoy
Basic Usage
FluidNavBar is simply a bottom navigation bar but with a very cool and fluid effect while
animating the transition between an active button to another one.
The example below shows you the minimal code to use the widget.
(1) Create an instance of FluidNavBar
(2) Set the icons, of type FluidNavBarIcon, to display in the navigation bar
(3) FluidNavBarIcon supports SVG asset or IconData
(4) Set the callback to react when the user tap an icon (the callback parameter contains the icon's index)
When defining FluidNavBarIcon you can provide an SVG asset or an IconData. Use the field svgPath for an SVG or
the field icon for an IconData.
Note: For backward compatibility (previous to v1.2.0) you can still use the field iconPath to set
the SVG asset to use (this is the same behaviour of svgPath). But this field has been deprecated and will
be removed in a future version.
How To Style
FluidNavBar comes with a default set of styles which are directly inherited from the gskinner showcase.
You can override different properties to adapt the fluid navigation bar to your current design:
the bar background color (Colors.white by default)
the icon background color (the same color as the bar background color by default)
the icon foreground color when it's selected (Colors.black by default)
the icon foreground color when it's unselected (Colors.grey by default)
Global Styles
The easiest way is to define one or more properties in a FluidNavBatStyle and set this instance
in the style property of the FluidNavBar:
Note: In this example I used also a global style for the foreground color of unselected icons, as I don't want
to set the same color for all icons
Properties:
Property
Description
backgroundColor
Set the background color of the icon
selectedForegroundColor
Set the foreground color for a selected icon
unselectedForegroundColor
Set the foreground color for all unselected icons
Styles Priorities
You can define global styles, local styles, both or no style at all!
To define the proper style to apply it tries, for each style, to resolve its value in the following order:
1- local style
2- global style
3- default value
when a value is resolved then it applies it to the widget.
For example if you set the global style iconBackgroundColor to Colors.red and you also
set the local style backgroundColor to Colors.green for an icon, then it will use the green color
as the local style will be resolved before the global one.
Other options
There are also few options, you can play with. They are global options and accessible throw FluidNaBar fields.
Property
Description
animationFactor
Set the factor to boost or slowdown animation. The default value is 1.0. If you use a value < 1 then the animation will be faster, if you use a value > 1 the animation will be slower
scaleFactor
Define the factor used by the animation to zoom the selected icon. The default value is 1.2. If the value is > 1 then it is a zoom-in, if you use a value < 1 then it is zoom-out
defaultIndex
Set to change selected item on start of the application. By default set to 0.
For an animationFactor of 2.0 (slower) and a scaleFactor of 2.0 (a zoom-in bigger than the default one), the result is:
Contributions
Feel free to create an issue if you find a bug or if you need new features. Of course PRs are welcome!