Search packages, repositories and app categories

expand_widget cover
Package detailsv3.1.1

expand_widget

Ability to easily expand and retract a widget collection or text

AndroidiOSWebmacOSWindowsLinux
30-day downloads
5.8K
Likes
147
Pub points
150

Install package

flutter pub add expand_widget

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The expand_widget package provides a simple and intuitive way to animate the expansion and contraction of widgets or text content. It enables smooth transitions between collapsed and expanded states, ideal for creating interactive UI elements like accordions or collapsible sections. Designed with ease of use in mind, it integrates seamlessly into Flutter apps across multiple platforms. The package supports custom animations, duration control, and flexible content layouts, making it suitable for both small components and complex UI structures.

Use cases

  • Creating collapsible accordions
  • Building interactive FAQ sections
  • Animating content reveal in lists
  • Designing responsive card interfaces
  • Implementing dynamic form sections

Key features

  • Smooth expand/retract animations
  • Customizable animation duration
  • Support for any widget as content
  • Easy integration with existing layouts
  • Flexible trigger mechanisms

Suitable for

  • Developers seeking simple expansion controls
  • UI designers building interactive cards
  • Apps requiring dynamic content toggling
  • Cross-platform Flutter applications
  • Projects with accordion-style interfaces

Considerations

  • May impact performance with large widget trees
  • Requires careful handling of state management
  • Animation behavior depends on parent layout constraints
  • Not optimized for extremely high-frequency toggles
  • Best used with lightweight content for optimal responsiveness

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Expand Widget

Package style: very good analysis Build Patreon License

This Dart package offers developers a streamlined library of Flutter widgets, useful for expanding widgets and text views, when users interact with them.

There are two main 'expand' widgets:

  • Expand Child: Useful to show more widgets related to the content already visible by the user.
  • Expand Text: Useful when texts can be quite big for a certain screen. It adds the ability to show the full content when the user wants to.

Features

  • The ExpandIndicatorStyle parameter allows you to select various render options, related to the expand arrow itself.

  • Hide the arrow widget when the view is being expanded, using the hideIndicatorOnExpand parameter.

  • Custimze the arrow widget itself: color, size, padding, icon...

  • You can also provide your own widget for the expand indicator, using the indicatorBuilder for both expaning widgets.

  • Use custom expanding hint strings! By default, it will use the ones provided by MaterialLocalizations.

  • Expand text view with swipe-down gestures, using the expandOnGesture, which by default is set to false.

  • You can also customize expand animation duration and curve easilly.

  • The collapsedVisibilityFactor (exclusive to the ExpandChild widget), allows the reveal of a section of the hidden content.

Example

Here is an example of a simple use of this package, featuring the ExpandChild & ExpandText widgets.

If you want to take a deeper look at the example, take a look at the example folder provided with the project.

  • ExpandChild
ExpandChild(
  child: Column(
    children: [
      OutlineButton(
        child: Text('Button1'),
        onPressed: () => print('Pressed button1'),
      ),
      OutlineButton(
        child: Text('Button2'),
        onPressed: () => print('Pressed button2'),
      ),
      OutlineButton(
        child: Text('Button3'),
        onPressed: () => print('Pressed button3'),
      ),
    ],
  ),
),
  • ExpandText
ExpandText(
  'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
  textAlign: TextAlign.justify,
),

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Built with

Authors

License

This project is licensed under the GNU GPL v3 License - see the LICENSE file for details.

Categories

Source repository

Projects using this package