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

flutter_scrolling_fab_animated 封面
插件详情v0.1.5

flutter_scrolling_fab_animated

用于添加滚动时大小会变化的悬浮按钮的包

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
484
喜欢数
68
Pub 分数
160

安装插件

flutter pub add flutter_scrolling_fab_animated

插件介绍

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

一个 Flutter 包,通过响应滚动事件来动画化浮动操作按钮(FAB),从而提升用户体验。当用户向下滚动时,FAB 会缩小或消失;向上滚动时,FAB 会放大或重新出现。这种行为有助于保持界面整洁,同时确保主要操作始终可访问。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常适合实现一致的跨平台设计。

适合场景

  • 滚动驱动的浮动按钮动画
  • 通过动态浮动按钮提升移动应用用户体验
  • 创建干净的界面并隐藏滚动时的浮动操作按钮
  • 跨多个平台的一致性 FAB 行为
  • 改善可滚动列表中的视觉层次结构

主要特点

  • 滚动时自动 FAB 大小动画
  • 跨平台兼容性
  • 与现有滚动视图的简单集成
  • 可配置的动画曲线
  • 支持收缩和展开的 FAB

适合对象

  • 移动和Web应用开发者
  • 专注于交互式 UI 的设计师
  • 包含长滚动内容的应用
  • 寻求轻量级 FAB 增强功能的开发者
  • 需要跨平台组件的项目

使用建议

  • 可能需要微调以获得最佳动画时间
  • 最适合单向滚动的屏幕
  • 除了大小和可见性之外,自定义选项有限
  • 不适合复杂的嵌套滚动场景
  • 取决于父滚动控件的行为

原始 README

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

Flutter Scrolling Fab Animated

This package is a floating button whose change of size when scroll down and return to its original size when on top again. It's useful with ListView widget and other scrollable widgets.

With animated icon

New Features 💥

  • Adding on long press support
  • Adding ripple effect for the button
  • Removing square shadow around the button when pressing it
  • Added gradient background

Instalation

Include flutter_scrolling_fab_animated in your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flutter_scrolling_fab_animated: version

Usage

To use this package, just import it into your file and enjoy it.

import 'package:bottom_sheet_expandable_bar/bottom_sheet_bar_icon.dart';
import 'package:flutter_scrolling_fab_animated/flutter_scrolling_fab_animated.dart';

...

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Scrolling Fab Animated Demo'),
      ),
      body: Container(
        child: new ListView.builder(
          controller: _scrollController,
          itemCount: items.length,
          itemBuilder: (BuildContext ctxt, int index) {
            return new Card(
              child: ListTile(
                title: Text(items[index]),
              )
            );
          }
        ),
      ),
      floatingActionButton: ScrollingFabAnimated(
        icon: Icon(Icons.add, color: Colors.white,),
        text: Text('Add', style: TextStyle(color: Colors.white, fontSize: 16.0),),
        onPress: (){},
        scrollController: _scrollController,
        gradient: const LinearGradient(colors: [Color(0xff0CA2E6),Color(0xff2E3D97),],begin: Alignment.topCenter, end: Alignment.bottomCenter),
        animateIcon: true,
        inverted: false,
        radius: 10.0,
      )
    );
  }

...

Example with a GridView

import 'package:bottom_sheet_expandable_bar/bottom_sheet_bar_icon.dart';
import 'package:flutter_scrolling_fab_animated/flutter_scrolling_fab_animated.dart';

...

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Scrolling Fab Animated Demo'),
      ),
      body: Container(
        child: new GridView.builder(
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
          controller: _scrollController,
          itemCount: items.length,
          itemBuilder: (BuildContext ctxt, int index) {
            return new Card(
              child: ListTile(
                title: Center(child: Text(items[index])),
              )
            );
          }),
      ),
      floatingActionButton: ScrollingFabAnimated(
        icon: Icon(Icons.add, color: Colors.white,),
        text: Text('Add', style: TextStyle(color: Colors.white, fontSize: 16.0),),
        onPress: (){},
        scrollController: _scrollController,
        animateIcon: true,
        inverted: false,
        radius: 10.0,
      )
    );
  }

...

Properties
Name Description Required Default
icon Widget to use as button icon True
text Widget to use as button text when button is expanded True
onPress Function to use when press the button True
scrollController ScrollController to use to determine when user is on top or not True
elevation Double value to set the button elevation False 5.0
shadowColor Color value to set the button shadow color False ThemeData.shadowColor
width Double value to set the button width when is expanded False 120.0
height Double value to set the button height False 60.0
duration Value to set the duration for animation False 250 milliseconds
curve Value to set the curve for animation False Curves.easeInOut
limitIndicator Double value to set the boundary value when scroll animation is triggered False 10.0
color Color to set the button background color False Colors.blueAccent
gradient Color to set the button background gradient False null
animateIcon Value to indicate if animate or not the icon False true
inverted Value to inverte the behavior of the animation False false
radius Double value to set the button radius False null

所属分类

源码仓库

使用此插件的项目

暂无相关数据。