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

animated_sidebar 封面
套件詳情v1.0.1

animated_sidebar

適用於 Flutter 的可摺疊側邊欄外掛程式,專為 Web 和桌面應用程式優化。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
244
喜歡數
42
Pub 分數
150

安裝套件

flutter pub add animated_sidebar

套件介紹

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

Animated Sidebar 是一個 Flutter 插件,提供適用於 Web 和桌面應用的可摺疊側邊欄。它具備流暢的動畫效果和響應式行為,增強了大型介面中的導航體驗。側邊欄可平滑地展開或收起,跨平台提升使用者體驗。此插件注重效能,可無縫整合至針對多種環境(包括行動、Web 和桌面)的應用中。非常適合儀表板、管理面板以及需要高效空間管理的複雜 UI。

適用情境

  • 儀表板導航
  • 管理面板介面
  • 桌面應用程式佈局
  • Web 應用側邊欄
  • 跨平台應用

主要特色

  • 平滑的可摺疊動畫
  • 適用於網頁和桌面的響應式設計
  • 跨平台相容性
  • 可自定外觀
  • 與現有 Flutter 項目輕鬆整合

適合對象

  • 開發網路/桌面應用程式的開發者
  • 專注於導航效率的UI設計師
  • 需要動態側邊欄行為的專案
  • 具有複雜導航結構的應用程式
  • 針對多個平台的 Teams

使用建議

  • 最適合用於網頁和桌面使用情境
  • 可能需要額外的樣式以滿足行動裝置的特定需求
  • 性能取決於動畫的複雜程度
  • 除了基本樣式之外,自定選項有限
  • 未針對僅行動應用進行優化

原始 README

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

Animated Sidebar

pub package Libraries.io for GitHub License

A highly customizable and styleable collapsable sidebar plugin for Flutter, optimized for web and desktop applications.

Example

example-ui

Installation

Add the following to your pubspec.yaml file:

dependencies:  
 animated_sidebar: ^1.0.0   

or use the following command:

flutter pub add animated_sidebar  

Add the following import to your dart file:

import 'package:animated_sidebar/animated_sidebar.dart';  

Usage

Sidebar Items

define a list of SidebarItem objects:

import 'package:animated_sidebar/animated_sidebar.dart';  
  
final List<SidebarItem> items = [  
  SidebarItem(icon: Icons.home, text: 'Home'),  
  SidebarItem(icon: Icons.notifications, text: 'Notifications'),  
  SidebarItem(icon: Icons.person, text: 'Management'),  
];  
Child Items

it is also possible to define multiple SidebarChildItem for every SidebarItem.

import 'package:animated_sidebar/animated_sidebar.dart';  
  
final List<SidebarItem> items = [  
  SidebarItem(icon: Icons.home, text: 'Home'),  
  SidebarItem(  
    icon: Icons.person,  
    text: 'Management',  
    children: [  
	  SidebarChildItem(icon: Icons.person, text: 'Users'),  
	  SidebarChildItem(icon: Icons.verified_user, text: 'Roles'),  
    ],  
  ),
];  

The Item Containing the Children is Collapsed and expand only on tap. If the Current selected item is a SidebarChildItem the overlying Item keeps expanded

Default usage of AnimatedSidebar
import 'package:animated_sidebar/animated_sidebar.dart';

@override
Widget build(BuildContext context) {
  return Scaffold(
    backgroundColor: Theme.of(context).scaffoldBackgroundColor,
    body: Row(
      children: [
        AnimatedSidebar(
          expanded: MediaQuery.of(context).size.width > 600,
          items: items,
          selectedIndex: 0,
          onItemSelected: (index) => print(index),
          headerIcon: Icons.ac_unit_sharp,
          headerIconColor: Colors.amberAccent,
          headerText: 'Example',
        ),
        Center(
          child: Text(
            'Page: $activeTab',
            style: Theme.of(context).textTheme.headline3,
          ),
        ),
      ],
    ),
  );
}
Use the AnimatedSidebar widget and handle state external :
import 'package:animated_sidebar/animated_sidebar.dart';

int activeTab = 0;

@override
Widget build(BuildContext context) {
  return Scaffold(
    backgroundColor: Theme.of(context).scaffoldBackgroundColor,
    body: Row(
      children: [
        AnimatedSidebar(
          expanded: MediaQuery.of(context).size.width > 600,
          items: items,
          selectedIndex: activeTab,
          autoSelectedIndex: false, // must be false if you want to handle state external
          onItemSelected: (index) =>
              setState(() => activeTab = index),
          headerIcon: Icons.ac_unit_sharp,
          headerIconColor: Colors.amberAccent,
          headerText: 'Example',
        ),
        Center(
          child: Text(
            'Page: $activeTab',
            style: Theme.of(context).textTheme.headline3,
          ),
        ),
      ],
    ),
  );
}

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。