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

flutter_wall_layout 封面
插件详情v2.1.2

flutter_wall_layout

一个布局小部件,以垂直或水平列表的形式显示一组砖块(具有不同形状的小部件),就像一堵墙一样……

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2570
喜欢数
133
Pub 分数
150

安装插件

flutter pub add flutter_wall_layout

插件介绍

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

一个 Flutter 包,提供了一个灵活的布局小部件,用于在垂直或水平列表中排列砖块(形状各异的小部件),类似于一堵墙。它支持动态大小和定位,非常适合创建具有不规则形状元素的视觉上吸引人的网格。该布局可适应不同的屏幕尺寸和方向,确保跨平台的响应式设计。特别适用于相册、仪表板和需要非均匀布局的创意 UI。

适合场景

  • 带有混合纵横比的照片画廊
  • 仪表板小部件具有不同尺寸
  • 具有不规则形状的创意UI布局
  • 响应式网格在多个平台上显示
  • 交互式墙状界面

主要特点

  • 支持不同形状和大小的砖块
  • 垂直和水平方向选项
  • 响应式和自适应布局
  • 跨平台兼容性
  • 与现有 Flutter widget 的轻松集成

适合对象

  • 寻求视觉多样性的设计师
  • 开发动态网格的开发者
  • 需要非均匀布局的应用程序
  • 针对多个平台的项目
  • 具有复杂布局的UI密集型应用

使用建议

  • 性能可能随着砖块数量增多而变化
  • 需要仔细处理砖块大小约束
  • 有限的内置动画
  • 最适合静态或低动态内容
  • 可能需要自定义逻辑来处理复杂交互

原始 README

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

flutter_wall_layout - Layout child having different shape into a vertical or horizontal list

This library provides a unique widget, WallLayout, rendering into a list children having different shapes.

There is two main classes: WallLayout and Stone.

  • A wall is composed by a set of stones, arranged in a certain way.
  • A stone is a component defining its shape by a width and a height.
Wall Layout Widget

This component has been inspired by the ListView widget, in which you can choose scroll direction and the way. Added to that, you can also define how many rows or column have the wall, if you want to create a responsive design.

WallLayout(
  stones: _buildStonesList(),
  layersCount: 3,
  scrollDirection: Axis.vertical,
  reverse: false,
);
Wall Layout Widget Properties
Parameter Description Default value
stones List of Stone widgets, representing wall layout's children. -
layersCount Define the number of layers the wall have. Must be higher or equal to 2. When direction is Axis.vertical, it defines the number of columns the wall has. When direction is Axis.horizontal, it defines the number of rows. -
wallBuilder Define how the wall is built: where each stone is positioned within the wall.The wall builder is allowed to use less stones than provided, and can create new stones (see ./example for more details). WallBuilder.standard()
stonePadding Padding between stones. 16.0
primaryAxisStoneSize Optional. If specified, indicates the exact size of each stone in the direction of the primary scroll axis. If not specified, each stone will be exactly square. -
scrollController Same as [ListView.scrollController]: "control the position to which this scroll view is scrolled". -
physics Same as [ListView.physics]: "How the scroll view should respond to user input". -
restorationId Same as [ListView.restorationId]: used "to save and restore the scroll offset of the scrollable". -
dragStartBehavior Same as [ListView.dragStartBehavior]: "Determines the way that drag start behavior is handled". DragStartBehavior.start
clipBehavior Same as [ListView.clipBehavior]: "ways to clip a widget's content". Clip.hardEdge
primary Same as [ListView.primary]: "Whether this is the primary scroll view associated with the parent [PrimaryScrollController]" false
scrollDirection Same as [ListView.scrollDirection]: "axis along which the scroll view scrolls". Axis.vertical
reverse Same as [ListView.reverse property]: "whether the scroll view scrolls in the reading direction". false
Stone Widget

A Stone Widget is a widget proxy defining stone's size (width and height). It's rendered object is optimized thanks to it's id property.

Stone(
    id: 7,
    width: 2,
    height: 2,
    child: Container(
      color: Colors.red,
      child: Center(child: Text("2x2")),
    ),
);
Stone Widget Properties
Parameter Description Default value
width Stone width (relative to the number of wall divisions). Must be higher or equal to 1. -
height Stone height (relative to the number of wall divisions). Must be higher or equal to 1. -
id Proxy layout identifier: must be unique. -
child Widget to render, where its size will be constrained by the stone width and height. -

所属分类

源码仓库

使用此插件的项目

暂无相关数据。