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

photo_card_swiper 封面
插件详情v0.0.6

photo_card_swiper

一个简单的 Flutter 包,用于创建照片列表的滑动卡片布局。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
18
喜欢数
43
Pub 分数
130

安装插件

flutter pub add photo_card_swiper

插件介绍

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

一个轻量级的Flutter包,旨在创建可滑动的卡片界面以显示照片列表,灵感来自Tinder风格的交互。它支持流畅的水平滑动和直观的手势操作,非常适合用于照片画廊或基于图像的内容发现。该包支持Android、iOS、Web、macOS、Windows和Linux等多个平台,确保跨平台的一致性。设计时注重简单性,可轻松集成到现有的Flutter项目中,配置需求极少。

适合场景

  • 照片画廊
  • 图像浏览应用
  • 类似Tinder的界面
  • 内容发现功能
  • 社交媒体动态
  • 视觉叙事应用

主要特点

  • 向左/向右滑动手势
  • 流畅的动画过渡
  • 跨平台支持
  • 简单 API 集成
  • 可自定义的卡片外观
  • 内置手势识别

适合对象

  • 开发图像密集型应用的开发者
  • 需要可滑动卡片UI的项目
  • 带有视觉内容的移动和网络应用
  • 原型设计交互布局
  • 用户驱动内容选择的应用程序

使用建议

  • 超出基本样式的定制功能有限
  • 无内置图像加载(需要外部包)
  • 可能需要对大型图像列表进行性能优化
  • 不适合复杂的拖放交互
  • 依赖外部依赖项进行图像处理

原始 README

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

photo_card_swiper

Language: English

A simple flutter package for creating a swiping card layout for list of photos.

photo_card_swiper is a photo slider resembling card stack. Card comprises options to reflect like, dislike and favorite feature. The card elements are highly customisable. This layout is quite common in social media apps like Instagram, tinder etc.

Technical Notes:

The layout for pages is built using stack of draggable widgets using LayoutBuilder. This package supports cards to be tapped too. Dev have options show 2 or 3 buttons, change the color, icon name and icon color of those buttons too.

How to use it.

the usage is very simple, just use the following code for default rendering of photos. Default values for Icons and Colors are taken care for easy usage.

PhotoCardSwiper(
     photos: widget._photos,
     showLoading: false,
 ),

or use the following with customizations

 PhotoCardSwiper(
     photos: widget._photos,
     showLoading: true,
     hideCenterButton: false,
     leftButtonIcon: Icons.close,
     rightButtonIcon: Icons.check,
     centerButtonIcon: Icons.favorite,
     leftButtonBackgroundColor: Colors.red[100],
     rightButtonBackgroundColor: Colors.lightGreen[100],
     centerButtonBackgroundColor: Colors.lightBlue[50],
     leftButtonIconColor: Colors.red[600],
     rightButtonIconColor: Colors.lightGreen[700],
     centerButtonIconColor: Colors.lightBlue[600],
     leftButtonAction: _leftButtonClicked,
     rightButtonAction: _rightButtonClicked,
     centerButtonAction: _centerButtonClicked,
     onCardTap: _onCardTap,
     cardSwiped: _cardSwiped,
 ),

Parameters for photo_card_swiper

parameter description value
photos Array of Photo data to be rendered as cards, Use PhotoCard object to group card details. [PhotoCard]()
showLoading Toggle the value to show/hide loading card This is a optional parameter. value cane be true/false
hideCenterButton Use this to have only 2 action buttons. This is a optional parameter. Pass either true/false
leftButtonIcon Left button Icon This is a optional parameter. Pass IconData type value
rightButtonIcon Right button Icon This is a optional parameter. Pass IconData type value
centerButtonIcon Center button Icon This is a optional parameter. Pass IconData type value
leftButtonBackgroundColor Left button Background Color This is a optional parameter. Pass Color type value
rightButtonBackgroundColor Right button Background Color This is a optional parameter. Pass Color type value
centerButtonBackgroundColor Center button Background Color This is a optional parameter. Pass Color type value
leftButtonIconColor Left button Icon Color This is a optional parameter. Pass Color type value
rightButtonIconColor Right button Icon Color This is a optional parameter. Pass Color type value
centerButtonIconColor Center button Icon Color This is a optional parameter. Pass Color type value
leftButtonAction Left button click handler This is a optional parameter. Pass method to be called on click.
rightButtonAction Right button click handler This is a optional parameter. Pass method to be called on click.
centerButtonAction Center button click handler This is a optional parameter. Pass method to be called on click.
onCardTap Background color of Tabbar This is a optional parameter. Example pass method with completion handler. (int _index) { }
cardSwiped Background color of Tabbar This is a optional parameter. Example pass method with completion handler. (CardActionDirection _direction, int _index) { }

Attributes/Properties of PhotoCard

parameter description default
title String to be displayed in title Text widget empty string
description String to be displayed in description Text widget empty string
imagePath Image path of image, either local assets folder image or http image path empty string
isLocalImage Value is true if imagePath is local assets folder image, Value is true if imagePath is http image path true

Please note try to load max of 10 photos at one time. This helps stack to be neat. To show more photos load them on pagination basis using cardSwiped method.

The usage is well described in the example code.

git repo here

Made with ❤ and dedicated with respect to the Saviour Sonu Sood

所属分类

源码仓库

使用此插件的项目

暂无相关数据。