搜索插件、代码仓与 APP 分类

animated_sidebar 封面
插件详情v1.0.1

animated_sidebar

一个适用于 Flutter 的可折叠侧边栏插件,专为 Web 和桌面应用程序优化。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
308
喜欢数
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,
          ),
        ),
      ],
    ),
  );
}

所属分类

源码仓库

使用此插件的项目

暂无相关数据。