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

card_actions 封面
插件详情v0.0.1

card_actions

使用我们的 Flutter 包,为您的卡片添加自定义操作和增强功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
402
喜欢数
73
Pub 分数
150

安装插件

flutter pub add card_actions

插件介绍

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

Card Actions 是一个 Flutter 包,可为卡片控件增强自定义操作和交互功能。它使开发者能够向卡片添加滑动手势、点击交互以及动态内容变化,从而提升用户参与度。该包专为列表、仪表板或基于卡片的 UI 设计,支持 Android、iOS、Web、macOS、Windows 和 Linux 等多个平台。通过简单的 pub add 命令,可无缝集成到现有的 Flutter 项目中。其轻量级设计注重性能与易用性,非常适合现代、响应式的卡片界面。

适合场景

  • 交互式卡片滑动
  • 动态卡内容更新
  • 手势驱动的卡片交互
  • 基于卡片的仪表板
  • 通过卡片操作获取用户反馈
  • 跨平台卡片增强功能

主要特点

  • 滑动操作支持
  • 可自定义的点击和手势响应
  • 轻量且高性能
  • 多平台兼容性
  • 与 Flutter 的轻松集成
  • 可扩展的操作处理程序

适合对象

  • 开发卡片密集型 UI 的开发者
  • 需要交互式卡片元素的应用程序
  • 跨平台移动和网页应用
  • 使用可重用的卡片组件设计系统
  • 原型设计交互式布局

使用建议

  • 需要理解 Flutter 手势系统
  • 可能需要额外的样式来处理复杂交互
  • 最适合简单到中等复杂度的卡片行为
  • 不适用于全屏导航
  • 仅限卡片级别交互

原始 README

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

Features

  • ✨ Simple Use
  • ⚙️ Great Customization
  • 🌍 Expand the functionality of your cards
  • 🛑 Not use for mobile devices, will soon be available for use on those platforms.

Getting Started

To use this card actions package, you need to add the dependencies in pubspec.yaml file.

dependencies:
    card_actions: ^0.0.1

Use

To use card actions is very simple, just wrap your card with our CardActions widget,

CardActions(
    ...
    child: YourCard() // here would be your card
)
Basic Setup

CardActions needs the parameters width, height and actions

  • width is the width of the widget
  • height is the height of the widget
  • actions is a list of CardActionButton.
CardActions(
    width: //your card width
    height: // your card height
    actions: <CardActionButton>[
        CardActionButton(
            icon: Icon(
                Icons.edit,
                color: Colors.white,
            ), // Icon
            label: 'edit',
            onPress: () {},
        ), // CardActionButton
    ]
    child: yourCard(), // here would be your card 
)

You can add more buttons if you prefer

...
actions: [
    CardActionButton(
        icon: Icon(
            Icons.edit,
            color: Colors.white,
        ),
        label: 'edit',
        onPress: () {},
    ),
    CardActionButton(
        icon: Icon(
            Icons.payment_rounded,
            color: Colors.white,
        ),
        label: 'Pay',
        onPress: () {},
    ),
    CardActionButton(
        icon: Icon(
            Icons.remove_red_eye_sharp,
            color: Colors.white,
        ),
        label: 'Preview',
        onPress: () {},
    ),
]

Axis Direction

If you want to change the direction of the hover, you can use the axisDirection property of the CardAction to change it.

the axisDirection property receives a enum of type CardActionAxis at the moment we only have bottom and right.

CardActionAxis.bottom CardActionAxis.right

Example

To make this example, we will need to configure more things, but it will be very simple, the first thing is that we change the background color for it we have to use the property backgroundColor then an important part is that we change the design of the cursor when it is on top of the buttons and this we can do it in two ways:

  • In the CardAction we have the buttonsCursor property that serves to change the cursor to ALL the buttons.

  • In the CardActionButton we have the cursor property to change the cursor to that specific button.

Important. If you use both options at the same time the button will prioritize its own cursor setting over the global setting with buttonsCursor.

and finally we add the necessary functions to the buttons by means of its onPress method.

...
actions: [
    CardActionButton(
        icon: Icon(
            Icons.add,
            color: Colors.white,
            size: 30,
        ),
        label: 'Increment',
        onPress: increment // method to increase the counter,
    ),
    CardActionButton(
        icon: Icon(
            Icons.restore_sharp,
            color: Colors.white,
            size: 30,
        ),
        label: 'Reset',
        onPress: () {
            // reset the counter
            setState(() {
            counter = 0;
            });
        },
    ),
    CardActionButton(
        icon: Icon(
            Icons.remove,
            color: Colors.white,
            size: 30,
        ),
        label: 'Decrement',
        onPress: decrement // method for decrementing the counter
    ),
]

RoadMap

  • Add options to handle card animation.
  • Make it usable on mobile devices, but instead of hover, click on the card, or hold down.
  • Add more axes and even be able to use several at the same time.

Parameters

CardActions
Property Type Default Description
width double required widget width
height double required widget height
cardCursor MouseCursor SystemMouseCursors.basic the type of cursor displayed when hovering on the card
buttonsCursor MouseCursor SystemMouseCursors.basic the type of cursor displayed when hovering over buttons
borderRadius double 0 rounded card edges
showToolTip bool true Show/Hide toolTips
axisDirection CardActionAxis CardActionAxis.bottom CardActions Axis Direction
splashColor Color Colors.white24 Splash color when hovering
backgroundColor Color Color(0xff242120) Background color
closeCardWhenExecuteFunction bool false close the card when you press a button
CardActionButton
Property Type Default Description
icon Icon required Button icon
label String required text to be displayed in the Tool Tip
onPress VoidCallback required callback to be executed when you press the button
closeCardWhenPress bool false when you press the button, the card closes.
cursor MouseCursor? null Cursor displayed when hovering on the button

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。