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

animated_button_bar 封面
插件详情v1.0.0

animated_button_bar

一个高度可定制的按钮栏,选中项具有动画效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
604
喜欢数
82
Pub 分数
150

安装插件

flutter pub add animated_button_bar

插件介绍

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

一个可自定义的 Flutter 按钮栏,当选择某个项目时具有平滑的动画效果。它允许开发者创建交互式、视觉上引人入胜的导航栏,并在按钮之间实现动画过渡。该包支持多个平台,并提供丰富的样式选项,包括颜色、形状和动画持续时间。非常适合需要直观的类似标签页导航并带有动态反馈的应用程序。

适合场景

  • 交互式导航栏
  • 标签式界面
  • 动画用户界面转换
  • 可自定义的底部导航
  • 用户对选择的反馈
  • 移动和Web应用仪表板

主要特点

  • 平滑的选择动画
  • 高度可定制的外观
  • 跨平台支持
  • 可配置的动画持续时间
  • 灵活的布局选项
  • 支持轻触手势

适合对象

  • Flutter 开发者构建现代 UI
  • 需要动画导航的应用
  • 专注于用户体验的设计人员
  • 面向多个平台的项目
  • 希望拥有可重用组件的开发者

使用建议

  • 包含大量项目时可能影响性能
  • 需要仔细调整动画速度
  • 有限的内置主题
  • 不适用于简单的静态按钮
  • 依赖于正确的状态管理
  • 最好与响应式设计模式一起使用

原始 README

以下为关联源码仓库的 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

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

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目