v1.1.0shaped_bottom_bar
여러 내장된 형태를 지원하는 완전히 사용자 정의 가능한 하단 네비게이션 바이며, 사용자 지정 형태도 지원하며 내장된 전환 애니메이션도 제공
koukibadr/Shaped-Bottom-Bar open-source repository details.
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A new bottom bar in Flutter! a shaped bottom bar.
Choose your shape and your animation and let us do the work.
![]() |
![]() |
|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Add this line to pubspec
dependencies:
shaped_bottom_bar: ^1.1.0
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:
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 getOther 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.
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
)
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(),
))
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:
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
),
의존성 목록 3 개
{"sdk":"flutter"}{"sdk":"flutter"}^1.0.4사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗