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

stacked_listview 封面
插件详情v1.0.4

stacked_listview

一个堆叠子项的 ListView。当滚动时,每个子项将首先被堆叠。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1640
喜欢数
52
Pub 分数
150

安装插件

flutter pub add stacked_listview

插件介绍

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

StackedListView 是一个 Flutter 小部件,它将子项堆叠在一起显示,第一个项目完全可见,后续项目在用户滚动时部分重叠。它创造出一种视觉上引人入胜的效果,使项目看起来彼此堆叠,非常适合创建动态、分层的列表界面。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,使其在跨平台应用中具有高度的通用性。它专为寻求独特列表动画但无需复杂自定义绘制的开发者设计。

适合场景

  • 创建分层可滚动列表
  • 设计具有深度的基于卡片的用户界面
  • 构建视觉丰富的信息流布局
  • 实现交互式堆叠项目过渡
  • 通过视觉提示增强移动应用导航

主要特点

  • 堆叠子项渲染
  • 带有图层效果的平滑滚动
  • 跨平台兼容性
  • 通过 pub 简单集成
  • 可自定义的堆叠行为
  • 内置动画支持

适合对象

  • 寻求视觉深度的UI设计师
  • 开发现代应用程序界面的开发者
  • 带有卡片或时间线样式内容的应用
  • 需要微妙动画列表效果的项目
  • Flutter 初学者探索高级列表模式

使用建议

  • 包含大量项目时可能影响性能
  • 需要仔细的布局规划
  • 最适合中等数量的项目
  • 超出堆叠之外的自定义功能有限
  • 不适合密集数据列表
  • 需要在低端设备上进行测试

原始 README

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

A Stacked ListView

Video

v1.0.4 Breaking Change

  • onRemove(int index) changed to onRemove(int index, AxisDirection dir)
  • beforeRemove(int index) changed to beforeRemove(int index, AxisDirection dir)
🎉🎉 Yes, Now you can know the user's swipe direction for each list item 🎉🎉

Install

flutter pub add stacked_listview

Example code:

Scaffold(
  appBar: AppBar(),
  backgroundColor: Colors.black,
  body: SafeArea(
    child: StackedListView(
      padding: EdgeInsets.only(left: 20, right: 20, top: 50),
      itemCount: data.length,
      itemExtent: itemHeight,
      heightFactor: 0.7,
      fadeOutFrom: 0.7,
      onRemove: (index, direction) {
        setState(() {
          data.removeAt(index);
        });
      },
      beforeRemove: (index, direction) async {
        return await showDialog<bool>(
          context: context,
          builder: (_) => AlertDialog(
            title: Text('Delete ${data[index]} ?'),
            actions: [
              TextButton(
                  onPressed: () => Navigator.pop(context),
                  child: Text('Cancel')),
              ElevatedButton(
                onPressed: () => Navigator.pop(context, true),
                child: Text('Delete'),
              ),
            ],
          ),
        ).then((value) => value == true);
      },
      builder: (_, index) {
        return Container(
          width: double.infinity,
          height: itemHeight,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(20.0)),
            color: Colors.white,
            boxShadow: [
              BoxShadow(color: Colors.black.withAlpha(100), blurRadius: 10),
            ],
          ),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                data[index],
                style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
              ),
              Text('Slide to left or right to delete'),
            ],
          ),
          padding: EdgeInsets.all(20),
        );
      },
    ),
  ),
);

所属分类

源码仓库

使用此插件的项目

暂无相关数据。