패키지, 저장소 및 앱 카테고리 검색

expandable_widgets 표지
패키지 상세v1.0.3+1

expandable_widgets

이 패키지는 100% Dart로 작성된 Flutter용 확장 가능한 위젯을 제공합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
13
좋아요
36
Pub 점수
140

패키지 설치

flutter pub add expandable_widgets

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

expandable_widgets 패키지는 Flutter용으로 완전히 Dart 기반의 사용자 정의 가능한 확장 가능한 위젯 세트를 제공합니다. 부드러운 애니메이션을 갖춘 접기 가능한 콘텐츠 섹션을 만들 수 있게 해주며, 카드나 확장 타일에서 정보를 정리하는 데 이상적입니다. 이 패키지는 Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원하여 장치 간 일관된 동작을 보장합니다. pub add를 통해 간단하게 통합할 수 있으며, 동적 콘텐츠 가시성 제어를 가능하게 하여 사용자 경험을 향상시킵니다.

사용 사례

  • 접을 수 있는 자주 묻는 질문 섹션 만들기
  • 인터랙티브 제품 세부 정보 카드 만들기
  • 확장 가능한 탐색 메뉴 설계
  • 애니메이션 애코디언 구현
  • 작은 레이아웃에서 상세 정보 표시

주요 기능

  • 부드러운 애니메이션 전환
  • 완전히 사용자 정의 가능한 외관
  • 모든 주요 플러터 플랫폼을 지원합니다
  • 경량이고 순수한 Dart 구현
  • 기존 UI와의 간편한 통합

적합한 대상

  • 반응형 카드 기반 인터페이스를 구축하는 개발자
  • 인터랙티브 콘텐츠 전환을 필요로 하는 앱
  • 경량 확장 구성 요소가 필요한 프로젝트

고려 사항

  • 복잡한 레이아웃을 위해 추가 스타일링이 필요할 수 있습니다
  • 제한된 내장 테마 옵션
  • 매우 큰 데이터 세트에 최적화되지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Expandable Widgets

A package provides expandable widgets for Flutter, written in 100% Dart.

Why?

Fast

There are various ways of getting expandable behaviour in Flutter. This package provides boilerplate code and reduces production time.

Inclusive

Expandable Widgets offers a variety of uses. Check More Usecases

Easy

You can obtain the basic expandable widgets by writing one single line of code.

Examples

General Use:

You can use Expandable with two required parameters.

Expandable(
  firstChild: const Text('Hello world!'),
  secondChild: Center(child: const Text('Hello world!')),
),

Extended Example:

If you add subChild argument you will get an expandable with subtitle. See 1.0.2 or older versions for previous extended expandables.

Expandable(
  firstChild: Padding(
    padding: const EdgeInsets.all(8.0),
    child: Text(data, maxLines: 3, textAlign: TextAlign.justify),
  ),
  secondChild: Padding(
    padding: const EdgeInsets.all(8.0),
    child: Text(data, maxLines: 3, textAlign: TextAlign.justify),
  ),
  subChild: Text("Show Details"),
),

Expandable Text:

You can use ExpandableText by giving the required parameter, textWidget. ExpandableText will handle the rest.

ExpandableText(textWidget: Text(data, maxLines: 3),

More Usecases

Expandable

Let's say you want to use Expandable and Flutter's AnimatedIcon at the same time.

Just add the relevant animationController. Expandable will handle the rest!

Row(
  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  children: [
    Expandable(
      firstChild: Padding(
        padding: const EdgeInsets.only(right: 8.0),
        child: Text('Settings', style: TextStyle(fontSize: 18)),
      ),
      secondChild: Column(children: [Text('Option 1'), Text('Option 2'), Text('Option 3')]),
      animationController: _animationController,
      arrowLocation: ArrowLocation.left,
      arrowWidget: Padding(
        padding: const EdgeInsets.all(8.0),
        child: AnimatedIcon(icon: AnimatedIcons.menu_close, progress: _animation, size: 16),
      ),
    ),

Even more, one can combine AnimatedIcon and Expandable's rotation animation.

Give the same animation to AnimatedIcon and Expandable and finally, do not forget to add relevant animationController to Expandable.

    Expandable(
      firstChild: Padding(
        padding: const EdgeInsets.only(right: 8.0),
        child: Text('Settings', style: TextStyle(fontSize: 18)),
      ),
      secondChild: Column(children: [Text('Option 1'), Text('Option 2'), Text('Option 3')]),
      animation: _animation,
      animationController: _animationController,
      arrowLocation: ArrowLocation.left,
      arrowWidget: Padding(
        padding: const EdgeInsets.all(8.0),
        child: AnimatedIcon(icon: AnimatedIcons.menu_close, progress: _animation, size: 16),
      ),
    ),
  ],
),

Nested Expandable Widgets

Expandable(
  firstChild: Text('Nested Expandable Widgets'),
  secondChild: Expandable(
    borderRadius: BorderRadius.zero,
    boxShadow: [],
    firstChild: Text('Second Expandable'),
    secondChild: Expandable(
      borderRadius: BorderRadius.zero,
      boxShadow: [],
      firstChild: Text('Third Expandable'),
      secondChild: Center(child: Text('The End')),
    ),
  ),
),

ExpandableText

You can change the location of the arrow

ExpandableText(
  textWidget: Text(data).copyWith(maxLines: 3),
  arrowLocation: ArrowLocation.bottom,
  finalArrowLocation: ArrowLocation.bottom,
),

You can use helper text

ExpandableText(textWidget: Text(data, maxLines: 3), helper: Helper.text),

Customized ExpandableText with helper text

ExpandableText(
  textWidget: Text(data, maxLines: 5, textAlign: TextAlign.justify),
  backgroundColor: Colors.white,
  helper: Helper.text,
  helperTextList: const ['...More', '...Less'],
  helperTextStyle: const TextStyle(color: Colors.orange, fontWeight: FontWeight.bold),
  boxShadow: const [BoxShadow(color: Colors.orange, offset: Offset(2, 2), blurRadius: 4)],
  borderRadius: BorderRadius.circular(20.0),
  padding: const EdgeInsets.all(12.0),
  onPressed: () => print('hi!'),
),

Or you can remove the helper

ExpandableText(textWidget: Text(data, maxLines: 3), helper: Helper.none),

Known issues

For more info please see example.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.