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

custom_accordion 封面
插件详情v1.0.0

custom_accordion

Custom Accordion 包允许创建可展开的 Flutter 小部件,只需点击标题即可展开或折叠每个项目或项目列表。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
81
喜欢数
28
Pub 分数
160

安装插件

flutter pub add custom_accordion

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Custom Accordion 包提供了一个灵活且可自定义的可展开小部件,适用于 Flutter,使用户能够通过简单的标题点击创建可折叠部分。每个项目或项目组都可以动态地展开或收起,非常适合以简洁、互动的方式组织内容。该包支持 Android、iOS、Web、macOS、Windows 和 Linux 多个平台,适用于跨平台应用。该包轻量且易于集成,通过可自定义的属性为开发者提供了对样式和行为的完全控制。

适合场景

  • 可折叠的常见问题部分
  • 交互式表单向导
  • 动态内容导航
  • 嵌套可展开列表
  • 移动友好的数据组织

主要特点

  • 头部触发展开
  • 对多个项目的支持
  • 可自定义动画
  • 跨平台兼容性
  • 与现有控件的轻松集成

适合对象

  • 开发交互式 UI 的开发者
  • 需要可折叠内容的应用程序
  • 需要响应式设计的项目
  • 使用 Flutter 开发多平台应用的团队
  • 寻求可重用组件的UI设计师

使用建议

  • 需要手动处理状态管理
  • 有限的内置主题选项
  • 复杂布局可能需要额外的样式
  • 不适用于非常大的数据集
  • 依赖外部依赖项以实现高级功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Supported platforms
Pub package version. Open Source Love. Custom Accordion is released under the MIT license.

Custom Accordion

Create dynamic, interactive, and visually appealing accordions in your Flutter app with ease using the "Custom Accordion" package. This powerful library simplifies the process of adding collapsible sections to your UI, making it a breeze to manage and customize accordions to suit your design and functionality needs.

Table of contents

Demo Preview

Get Started

Add to your project
dependencies:
  custom_accordion: ^version

or simply run the command in your terminal at project root directory

flutter pub add custom_accordion
Import and use it!
import 'package:custom_accordion/custom_accordion.dart';

How to use

Basic Accordion

    CustomAccordion(
        title: 'Accordion',
        ),

Accordion with no child

    CustomAccordion(
        title: 'Accordion with no child',
        subTitle: 'Accordion Sub Title',
        headerBackgroundColor: Colors.blue,
        titleStyle: const TextStyle(
          fontSize: 18,
          fontWeight: FontWeight.bold,
          color: Colors.white,
        ),
        subTitleStyle: const TextStyle(
          fontSize: 16,
          fontWeight: FontWeight.normal,
          color: Colors.white,
        ),
        toggleIconOpen: Icons.keyboard_arrow_down_sharp,
        toggleIconClose: Icons.keyboard_arrow_up_sharp,
        headerIconColor: Colors.white,
        accordionElevation: 0,
        showContent: true,
        ),

Accordion with one child

    CustomAccordion(
        title: 'Accordion with one child',
        subTitle: 'Accordion Sub Title',
        headerBackgroundColor: Colors.blue,
        titleStyle: const TextStyle(
          fontSize: 18,
          fontWeight: FontWeight.bold,
          color: Colors.white,
        ),
          subTitleStyle: const TextStyle(
          fontSize: 16,
          fontWeight: FontWeight.normal,
          color: Colors.white,
        ),
        toggleIconOpen: Icons.keyboard_arrow_down_sharp,
        toggleIconClose: Icons.keyboard_arrow_up_sharp,
        headerIconColor: Colors.white,
        accordionElevation: 0,
        widgetItems: const Text(
          'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.',
          ),
        ),

Accordion with many child

    CustomAccordion(
        title: 'Accordion with many child',
        headerBackgroundColor: Colors.blue,
        titleStyle: const TextStyle(
          fontSize: 18,
          fontWeight: FontWeight.bold,
          color: Colors.white,
        ),
        toggleIconOpen: Icons.keyboard_arrow_down_sharp,
        toggleIconClose: Icons.keyboard_arrow_up_sharp,
        headerIconColor: Colors.white,
        accordionElevation: 0,
        widgetItems: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              Text(
                'Lorem Ipsum',
                style: Theme.of(context).textTheme.titleMedium,
              ),
              ElevatedButton(
                onPressed: () {},
                child: const Text(
                  'ELEVATED BUTTON',
                ),
              )
            ],
          ),
        ),

Accordion with List Items and disabled toggle example

        CustomAccordion(
            title: 'Accordion with List Items',
            subTitle: 'Accordion toggle disabled',
            headerBackgroundColor: Colors.blue,
            titleStyle: const TextStyle(
              fontSize: 18,
              fontWeight: FontWeight.bold,
              color: Colors.white,
            ),
            subTitleStyle: const TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.normal,
              color: Colors.white,
            ),
            toggleIconOpen: Icons.keyboard_arrow_down_sharp,
            toggleIconClose: Icons.keyboard_arrow_up_sharp,
            headerIconColor: Colors.white,
            accordionElevation: 0,
            disableToggle: true,
            widgetItems: Column(
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: List<Widget>.generate(5, (int index) {
                return Text('Item $index');
                }),
            ),
        ),

Please see example project for code.

Properties

The following properties can be set for the widget.

Property Description Type Required Default value
title Title of Accordion String Yes
subTitle Sub Title of Accordion String No
headerBackgroundColor Header background color Color No Theme.of(context).splashColor
titleStyle Header text style TextStyle No Theme.of(context).textTheme.titleLarge
subTitleStyle Sub Title text style TextStyle No Theme.of(context).textTheme.titleSmall
toggleIconOpen Toggle icon to expand/open widgets IconData No Icons.arrow_drop_down
toggleIconClose Toggle icon to collapse/close widgets IconData No Icons.arrow_drop_up
headerIconColor Icon Color Color No Theme.of(context).iconTheme.color
backgroundColor Background color of widget Color No Theme.of(context).cardColor
accordionElevation Elevation of accordion widget double No Theme.of(context).cardTheme.elevation
widgetItems Child Widget(s) of accordion Widget No Text()
widgetItemsPadding Padding arround children of accordion EdgeInsetsGeometry No EdgeInsets.all(10)
showContent Make default behaviour of accordion children visible or hidden bool No false
disableToggle Make default behaviour of accordion toggle bool No false

Contribution

🚀 We believe in the power of collaboration and welcome contributions from our amazing community to make Custom Accordion even more awesome!

Whether you're a developer, designer, or just an enthusiast, you can contribute in various ways:

  • 💡 Feature Ideas: Have a cool feature in mind? Share your ideas with us. We love fresh perspectives!
  • 🐛 Bug Reports: Spotted a bug? Let us know! Help us squash those pesky little critters.
  • 📖 Documentation: Improve our documentation. Clear and concise docs make a world of difference.
  • 🛠 Code Contributions: If you're a developer, dive into the codebase. Tackle open issues or implement new features.
  • 💬 Community Support: Share your knowledge! Help others by answering questions and engaging in discussions.
  • ✏️ Design: If you have design skills, contribute by enhancing our UI/UX.

Dig into CONTRIBUTING.MD, which covers submitting bugs, requesting new features, preparing your code for a pull request, etc.

Please don't forget to like, follow, and star our repo!.

Support the package (optional)

If you find this package useful, you can support it for free by giving it a thumbs up at the top of this page.

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket. Pull request are also welcome.

License

This package is available under the MIT License.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。