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

bottom_bar 封面
套件詳情v2.0.5

bottom_bar

底部欄有助於建立一個經過最佳化的底部導航欄,並具有美麗的動畫

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1400
喜歡數
137
Pub 分數
160

安裝套件

flutter pub add bottom_bar

套件介紹

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

Bottom Bar 是一個 Flutter 套件,讓開發者能夠建立優化且視覺上吸引人的底部導航列,並具備順暢的動畫效果。專為跨平台使用設計,支援 Android、iOS、Web、macOS、Windows 和 Linux。此套件透過可自訂的過渡效果、響應式設計以及內建的無障礙功能,簡化底部導航的實作。它透過在不同裝置上提供直覺的導航模式,提升使用者體驗。非常適合需要持續底部導航且具現代美學的應用程式。

適用情境

  • 行動應用程式導航
  • Web 應用程式儀表板
  • 跨平台桌面應用
  • 增強的使用者介面設計
  • 響應式導航佈局

主要特色

  • 流暢的動畫過渡
  • 可自定外觀
  • 跨平台相容性
  • 無障礙支援
  • 響應式設計整合

適合對象

  • 開發移動或網頁應用的開發者
  • 注重設計的UI實現
  • 需要一致導航的應用
  • 注重動畫質量的團隊
  • 針對多個平台的專案

使用建議

  • 需要 Flutter SDK 設定
  • 超出基本樣式的自訂功能有限
  • 可能需要額外的狀態管理
  • 不適合複雜的標籤結構
  • 依賴外部倉庫取得更新

原始 README

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

Bottom Bar

Bottom bar helps create an optimized bottom navigation bar with beautiful animations.

Bottom Bar

Content

Installation

Add bottom_bar to pubspec.yaml

dependencies:
  bottom_bar: ^2.0.5

Breaking Changes

  • darkActiveColor is removed to simplify the api. Instead, use PlatformBrightness to check dark mode and adjust the color accordingly

Usage

Import the Package

import 'package:bottom_bar/bottom_bar.dart';

Example

  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,
          ),
        ],
      ),
    );
  }

Parameters

BottomBar

Creates a BottomBar that displays a list of BottomBarItem
Required:
Optional:
  • backgroundColor - Background Color of BottomBar
  • height - Height of BottomBar
  • padding - Padding of BottomBar container
  • mainAxisAlignment - Describes how BottomBarItems are horizontally laid out
  • curve - Curve of animation
  • duration - Duration of animation
  • border - Border of BottomBarItem's background color
  • boxShadow - BoxShadow of BottomBar
  • itemPadding - Padding of BottomBarItem's background color
  • textStyle - TextStyle of title widget
  • showActiveBackgroundColor - Shows the background color of a selected BottomBarItem if set to true

BottomBarItem

Contains information about the item that BottomBar has to display
Required:
  • icon - Icon of BottomBarItem
  • title - Title of BottomBarItem (Typically a Text widget)
  • activeColor - Primary color of a selected BottomBarItem
Optional:
  • activeIconColor - Icon color of a selected BottomBarItem
  • activeTitleColor - Text color of a selected BottomBarItem
  • backgroundColorOpacity - Opacity of a selected BottomBarItem background color (Defaults to 15%)
  • inactiveIcon- Icon to display when BottomBarItem is not active
  • inactiveColor - Primary color of BottomBarItem when it is NOT selected

FAQ

My phone's notch is overlapping with BottomBar. How do I fix this?
  • Simply wrap BottomBar with a SafeArea widget.
How do I change the overall color of BottomBarItem when in dark mode?
  @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)
    ),
  }

Community Support

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

所屬分類

原始碼儲存庫

使用此套件的專案