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

shaped_bottom_bar 封面
套件詳情v1.1.0

shaped_bottom_bar

完全可自訂的底部導航欄,支援多種內建形狀,並支援自訂形狀,還具有內建的過渡動畫

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
13
喜歡數
25
Pub 分數
150

安裝套件

flutter pub add shaped_bottom_bar

套件介紹

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

一個完全可自訂的底部導航欄,適用於 Flutter,提供多種內建形狀並支援自訂形狀。它包含標籤之間的平滑過渡動畫,可實現視覺上吸引人的導航體驗。專為尋求美學彈性和跨平台無縫使用者互動的開發者設計。該套件輕量且容易與現有的 Flutter 應用整合。

適用情境

  • 行動應用程式中的自訂標籤設計
  • 增強的導航,帶有動畫過渡
  • 跨平台底部欄
  • 現代使用者介面實現
  • 互動式應用程式介面

主要特色

  • 多種內建形狀
  • 對自定義形狀的支援
  • 內建過渡動畫
  • 高度可自訂的樣式
  • 跨平台相容性

適合對象

  • Flutter 開發人員建構現代應用
  • 注重設計的UI實現
  • 需要獨特導航模式的應用程式
  • 想要動畫豐富的組件的開發者
  • 針對多個平台的專案

使用建議

  • 需要理解自定繪圖
  • 可能增加簡單用例的複雜性
  • 應在低階設備上測試動畫效能
  • 除了基本範例外,文件有限
  • 最適合具有專用導航需求的應用程式

原始 README

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

shaped bottom bar

A new bottom bar in Flutter! a shaped bottom bar.

Choose your shape and your animation and let us do the work.

enter image description here Slide_transition_example.gif
fade_transition_example.gif rotated_transition_example.gif
enter image description here enter image description here enter image description here enter image description here
enter image description here enter image description here -- --
  • Installation
  • Widgets introduction
  • Example

Installing

Add this line to pubspec

dependencies:
	shaped_bottom_bar: ^1.1.0

Widgets

ShapedBottomBar This the main widget that will create the bottom bar.

With just two required parameters you get a full bottom bar.

required parameters

  • onItemChanged function that trigger every time you switch between items

  • listItems list of type ShapedItemObject that will be rendered in the bottom bar

this will create a simple bottom bar without any shape with just a different color for the selected item

Other parameters

  • shape variable of type ShapeType enum contains all available shapes, by default it's set to None

  • shapeColor the color of the shape once it selected, by default it's null

  • customShape a CustomPaint type passed to the bottom bar to render a custom shape other than the built-in shapes, to use the customShape you need to set shape to ShapeType.CUSTOM

PS: if you are using customShape the shapeColor parameter won't have any effect on your shape.

  • selectedIconColor the selected icon color, by default it's white

  • backgroundColor the background of the shaped bottom bar, by default it's blue

  • selectedItemIndex the default selected item, by default it's the first one (index 0)

  • textStyle the text style you want to have on the items text (color, size, font family...)

  • animationType attribute of type ANIMATION_TYPE let you choose the animation type possible values:

    • NONE
    • ROTATE
    • FADE
    • SLIDE_VERTICALLY
  • with3dEffect enable/disable the 3D effect on bottom bar selected shape by default it's False


ShapedBottomBarItem the widget that will be used in the listItems parameters in the ShapedBottomBar widget

This widget contains just four parameters.

required parameters

  • icon variable of type IconData it represent the icon that the item will get

Other parameters

  • text the item text, by default it's an empty text.

  • themeColor color that will be set to the icon. by default it's black

  • renderWithText by default it's false, this will indicate whether the widget will render the text or not.

Example

this will generate a normale bottom bar without any shape.

ShapedBottomBar(
	backgroundColor:  Colors.grey,
	listItems: [
		ShapedItemObject(iconData:  Icons.settings, title:  "Settings"),
		ShapedItemObject(iconData:  Icons.account_balance_outlined, title:  "Account"),
		ShapedItemObject(iconData:  Icons.verified_user_rounded, title:  "User"),
		ShapedItemObject(iconData:  Icons.login, title:  "Logout")
	],
	onItemChanged: (position) {
		setState(() {
			this.selectedItem = position;
		});
	},
	selectedIconColor:  Colors.white
)

And the example below will generate a bottom bar with an hexagon shape


ShapedBottomBar(
	backgroundColor:  Colors.grey,
	iconsColor:  Colors.white,
	listItems: [
		ShapedItemObject(iconData:  Icons.settings, title:  "Settings"),
		ShapedItemObject(iconData:  Icons.account_balance_outlined, title:  "Account"),
		ShapedItemObject(iconData:  Icons.verified_user_rounded, title:  "User"),
		ShapedItemObject(iconData:  Icons.login, title:  "Logout"),
	],
	onItemChanged: (position) {
		setState(() {
			this.selectedItem = position;
		});
	},
	shapeColor:  Colors.pink,
	selectedIconColor:  Colors.white,
	shape:  ShapeType.HEXAGONE
)

Shaped bottom bar with hexagon shape

Use your own custom shape

In order to create the shaped bottom bar with your own custom shape you need to use the parameter customShape with shape set to ShapeType.CUSTOM, as it shown below:


ShapedBottomBar(
	backgroundColor:  Colors.blue[50],
	iconsColor:  Color(0xFF020750),
	listItems: [
		ShapedItembject(iconData:  Icons.settings, title:  "Settings"),
		ShapedItemObject(iconData:  Icons.account_balance_outlined, title:  "Account"),
		ShapedItemObject(iconData:  Icons.verified_user_rounded, title:  "User"),
		ShapedItemObject(iconData:  Icons.login, title:  "Logout"),
	],
	onItemChanged: (position) {
		setState(() {
			this.selectedItem = position;
		});
	},
	textStyle:  TextStyle(color:  Colors.black, fontSize:  15),
	shape:  ShapeType.CUSTOM,
	customShape:  CustomPaint(
		painter:  MyShape(),
	))

enter image description here

Use built-in animations


ShapedBottomBar(
	backgroundColor:  Colors.black12,
	iconsColor:  Colors.black,
	listItems: [
		ShapedItemObject(iconData:  Icons.alarm, title:  "Alarm"),
		ShapedItemObject(iconData:  Icons.menu_book, title:  "Menu"),
		ShapedItemObject(iconData:  Icons.verified_user_rounded, title:  "User"),
		ShapedItemObject(iconData:  Icons.login, title:  "Logout")
	],
	onItemChanged: (position) {
		setState(() {
			this.selectedItem = position;
		});
	},
	shape:  ShapeType.OCATGON,
	shapeColor:  Colors.black,
	selectedIconColor:  Colors.white,
	animationType:  ANIMATION_TYPE.ROTATE,
)

And the result:

rotated_transition_example.gif

Use 3D Effect Attribute

ShapedBottomBar(
	backgroundColor:  Colors.black12,
	iconsColor:  Colors.black,
	listItems: [
		ShapedItemObject(iconData:  Icons.alarm, title:  "Alarm"),
		ShapedItemObject(iconData:  Icons.menu_book, title:  "Menu"),
		ShapedItemObject(iconData:  Icons.verified_user_rounded, title:  "User"),
		ShapedItemObject(iconData:  Icons.login, title:  "Logout"),
	],
	onItemChanged: (position) {
		setState(() {
			this.selectedItem = position;
		});
	},
	shape:  ShapeType.SQUARE,
	shapeColor:  Colors.pink,
	selectedIconColor:  Colors.white,
	with3dEffect:  true,
	animationType:  ANIMATION_TYPE.FADE
),

square_with_3D_effect.png

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。