v2.0.5bottom_bar
바텀 바는 아름다운 애니메이션을 갖춘 최적화된 바텀 네비게이션 바를 만들 수 있도록 도와줍니다
137좋아요 62030일 다운로드160Pub 점수
AndroidiOSWebmacOSWindowsLinux
바텀 바는 아름다운 애니메이션을 갖춘 최적화된 바텀 네비게이션 바를 만들 수 있도록 도와줍니다
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Bottom bar helps create an optimized bottom navigation bar with beautiful animations.
Bottom Bar
Add bottom_bar to pubspec.yaml
dependencies:
bottom_bar: ^2.0.5
darkActiveColor is removed to simplify the api. Instead, use PlatformBrightness to check dark mode and adjust the color accordinglyimport 'package:bottom_bar/bottom_bar.dart';
int _currentPage = 0;
final _pageController = PageController();
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
controller: _pageController,
children: [
Container(color: Colors.blue),
Container(color: Colors.red),
Container(color: Colors.greenAccent.shade700),
Container(color: Colors.orange),
],
onPageChanged: (index) {
// Use a better state management solution
// setState is used for simplicity
setState(() => _currentPage = index);
},
),
bottomNavigationBar: BottomBar(
selectedIndex: _currentPage,
onTap: (int index) {
_pageController.jumpToPage(index);
setState(() => _currentPage = index);
},
items: <BottomBarItem>[
BottomBarItem(
icon: Icon(Icons.home),
title: Text('Home'),
activeColor: Colors.blue,
),
BottomBarItem(
icon: Icon(Icons.favorite),
title: Text('Favorites'),
activeColor: Colors.red,
),
BottomBarItem(
icon: Icon(Icons.person),
title: Text('Account'),
activeColor: Colors.greenAccent.shade700,
),
BottomBarItem(
icon: Icon(Icons.settings),
title: Text('Settings'),
activeColor: Colors.orange,
),
],
),
);
}
BottomBar that displays a list of BottomBarItemBottomBarBottomBarBottomBar containerCurve of animationDuration of animationBoxShadow of BottomBarPadding of BottomBarItem's background colorTextStyle of title widgetIcon of BottomBarItemBottomBarItem (Typically a Text widget)BottomBarItemBottomBarItemBottomBarItemBottomBarItem background color (Defaults to 15%)BottomBarItem is not activeBottomBarItem when it is NOT selected @override
Widget build(BuildContext context) {
bool isDarkMode = MediaQuery.of(context).platformBrightness == Brightness.dark;
BottomBarItem(
activeColor: isDarkMode ? Colors.orange : Colors.blue, // Is dark mode true? (Yes -> Colors.orange | No -> Colors.blue)
),
}
If you have any suggestions or issues, feel free to open an issue
If you would like to contribute, feel free to create a PR