FLUTTER ECOSYSTEM

JorisObert/animated_button_bar

애니메이션을 갖춘 사용자 정의 가능한 버튼 바

animated_button_bar 프로젝트 이미지
Stars
10
Forks
3
최근 푸시(UTC)
2023. 2. 18.
프로젝트 상태
활성
JorisObert GitHub avatar
GITHUB User

JorisObert ↗

언어C++CMakeDartHTMLCSwiftKotlinObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • provider^6.0.5
  • flutter_test개발 의존성{"sdk":"flutter"}

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

animated_button_bar

AnimatedButtonBar is a flutter library that allows you to create a row of buttons with an animation on selection.

Getting started

Add this to your app's pubspec.yaml file:

dependencies:  
  animated_button_bar: ^0.0.2

Usage

Then you have to import the package with:

import 'package:animated_button_bar/animated_button_bar.dart';  

And use an AnimatedBarButton like this:

  Column(  
          mainAxisAlignment: MainAxisAlignment.center,  
          children: [  
            //inverted selection button bar  
            AnimatedButtonBar(  
              radius: 8.0,  
              padding: const EdgeInsets.all(16.0),  
              invertedSelection: true,  
              children: [  
                ButtonBarEntry(onTap: () => print('First item tapped'), child: Text('Day')),  
                ButtonBarEntry(onTap: () => print('Second item tapped'), child: Text('Week')),  
                ButtonBarEntry(onTap: () => print('Third item tapped'), child: Text('Month')),  
                ButtonBarEntry(onTap: () => print('Fourth item tapped'), child: Text('Year'))  
              ],  
            ),  
            //You can populate it with different types of widgets like Icon  
            AnimatedButtonBar(  
              radius: 32.0,  
              padding: const EdgeInsets.all(16.0),  
              backgroundColor: Colors.blueGrey.shade800,  
              foregroundColor: Colors.blueGrey.shade300,  
              elevation: 24,  
              borderColor: Colors.white,  
              borderWidth: 2,  
              innerVerticalPadding: 16,  
              children: [  
                ButtonBarEntry(onTap: () => print('First item tapped'), child: Icon(Icons.person)),  
                ButtonBarEntry(onTap: () => print('Second item tapped'), child: Icon(Icons.people)),  
              ],  
            ),  
          ],  
        ),  

Result

https://raw.githubusercontent.com/JorisObert/animated_button_bar/HEAD/example2.gif

parameters

parameter description default
animationDuration animation duration when tap const Duration(milliseconds: 200)
backgroundColor main color of the widget Theme.of(context).backgroundColor
borderColor color of the border null
borderWidth width of the border borderColor != null ? 1.0 : 0.0;
children A list of ButtonBarEntry to display required
curve the curve for the animation Curves.fastOutSlowIn
elevation double 0
foregroundColor color for the selection Theme.of(context).accentColor
invertedSelection bool false
radius double 0.0
verticalPadding double 8.0