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

floating_pullup_card 封面
插件详情v1.2.0

floating_pullup_card

一个美观且可自定义的浮动抽拉式卡片,适用于 Flutter

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
58
喜欢数
69
Pub 分数
140

安装插件

flutter pub add floating_pullup_card

插件介绍

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

一个视觉上吸引人且可自定义的浮动拉起卡片小部件,专为 Flutter 设计,旨在增强底部面板的交互体验。它模拟了从屏幕底部拉起并漂浮的可拖动卡片行为,提供流畅的动画和响应式手势。非常适合用于模态框、详细视图或交互式覆盖层。该包支持 Android、iOS、Web、macOS、Windows 和 Linux 多个平台,确保在各种设备上行为一致。

适合场景

  • 可交互的底部面板
  • 模态详细视图
  • 可拖动的内容叠加层
  • 用户资料扩展器
  • 表单向导

主要特点

  • 平滑的拖拽和拉拽动画
  • 可自定义的高度和外观
  • 跨平台兼容性
  • 手势响应式设计
  • 可配置的吸附点
  • 与现有 UI 的轻松集成

适合对象

  • 开发交互式底部抽屉的开发者
  • 寻求优雅用户界面组件的设计人员
  • 需要可展开内容卡片的应用
  • 以移动设备为优先的应用程序,具有丰富的用户交互
  • 需要触摸友好面板的网页和桌面应用程序

使用建议

  • 可能需要额外的样式来适应复杂布局
  • 在内容较重的低端设备上的性能影响
  • 对动态内容的内置验证有限
  • 不适合全屏过渡
  • 需要仔细处理嵌套的滚动视图

原始 README

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

floating_pullup_card

A beautiful and custom floating pull up style Card for flutter

💻 Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  floating_pullup_card: <latest version>

Usage

Basic

You can get started really simple, just add

Basic Collapsed Basic Uncollapsed

FloatingPullUpCardLayout(
    child: Container(
        decoration: BoxDecoration(color: Colors.purple[100]),
        child: Placeholder(),
    ),
    body: Column(
        children: <Widget>[
            PlaceholderLines(
                count: 10,
                align: TextAlign.center,
            ),
        ],
    ),
),

where body is a Widget that is nested inside the card and child is the main layout content

Advanced

You can highly customize by defining custom builders, or properties as width , height, color, etc

Advanced Collapsed Advanced Uncollapsed

FloatingPullUpCardLayout(
        dismissable: _dismissable,
        state: _floatingCardState,
        dragHandleBuilder: _customDragHandle ? _customDragHandleBuilder : null,
        cardBuilder: _customCard ? _customCardBuilder : null,
        collpsedStateOffset:
            _customCollapsedOffset ? (maxHeight, _) => maxHeight * .75 : null,
        autoPadding: _autoPadd,
        body: Container(
          // padding: EdgeInsets.all(16),
          child: SingleChildScrollView(
            child: Column(
              children: <Widget>[
                PlaceholderLines(
                  count: 4,
                  align: TextAlign.center,
                ),
                /// ... more content
              ],
            ),
          ),
        ),
        child: Container(
          decoration: BoxDecoration(color: Colors.grey[300]),
          height: double.infinity,
          width: double.infinity,
          child: SingleChildScrollView(
            child: // ... Some content
            ),
          ),
        ),

For more info, please check the demo provided :)

Full API

/// The [Widget] to be used as the content of the main layout, not the card content
  final Widget child;

  /// The [Widget] to be used as the content of the floating card
  final Widget body;

  /// Set a custom [height] for the floating card,
  /// defaults to `86%` of total height of parent container or screen height if no finite height can be assumed
  final double height;

  /// Set a custom [width] for the floating card,
  /// defaults to `100%` of total width of parent container or screen width if no finite width can be assumed
  final double width;

  /// Set a [cardElevation] for the material,
  /// defaults to `4`
  final double cardElevation;

  /// If true , the card can be dragged until it's hidden from screen
  /// defaults to [false]
  final bool dismissable;

  /// Sets the [state] of the floating card,
  /// See enum [FloatingPullUpState] for more details
  /// Defaults to [FloatingPullUpState.collapsed]
  final FloatingPullUpState state;

  /// Set a custom card [color] to the card background
  /// defaults to [Colors.white]
  ///
  /// This doesnt take any effect if using [cardBuilder] is defined
  final Color cardColor;

  /// Called each time the [FloatingPullUpState] is changed
  final ValueChanged<FloatingPullUpState> onStateChange;

  /// Defines a custom [dragHandleBuilder]
  final DragHandleBuilder dragHandleBuilder;

  /// Defines a custom [cardBuilder]
  final FloatingCardBuilder cardBuilder;

  /// Set a custom [borderRadius] of the default Card material
  ///
  /// This doesnt take any effect if using [cardBuilder] is defined
  final BorderRadius borderRadius;

  /// if true , this automatically adds padding to the [child] container,
  /// avoiding the card to float on top of [child] content
  /// defaults to [true]
  final autoPadding;

  /// Sets a custom function that return a custom `Y Offset`  for state [FloatingPullUpState.collapsed]
  /// Please take into account that offset start from top to bottom
  StateOffsetFunction collpsedStateOffset;

  /// Sets a custom function that return a custom `Y Offset`  for state [FloatingPullUpState.hidden]
  /// Please take into account that offset start from top to bottom
  StateOffsetFunction hiddenStateOffset;

  /// Sets a custom function that return a custom `Y Offset`  for state [FloatingPullUpState.uncollapsed]
  /// Please take into account that offset start from top to bottom
  StateOffsetFunction uncollpsedStateOffset;

  /// Defines a callback to be called when a user taps outside the card
  /// If function returns [FloatingPullUpState] it will change state to the returned one
  /// Take into account that this is not getting called if a widget inside body is already handling a `Gesture`
  final FloatingPullUpState Function() onOutsideTap;

  /// If true, this will show an overlay behind the card tht obscures content behind
  /// Defaults to[false]
  final bool withOverlay;

  /// Defines the `color` of the overlay , this only takes effect of [withOverlayOption] is true
  final Color overlayColor;

More Screenshots

Advanced Advanced GIF

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.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。