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

figma_layout_grid 封面
插件详情v0.3.2

figma_layout_grid

支持 Figma 布局网格功能的视觉辅助网格系统

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
108
喜欢数
32
Pub 分数
160

安装插件

flutter pub add figma_layout_grid

插件介绍

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

一个 Flutter 包,实现了 Figma 的布局网格系统作为视觉辅助工具,帮助开发者将 UI 元素与设计规范一致对齐。它支持 Figma 的网格功能,如列数、间距大小和偏移量,使设计与实现之间的布局能够精确匹配。该网格以叠加层的形式显示在屏幕上,非常适合原型设计和开发。兼容所有主要平台,通过弥合 Figma 设计与实际 Flutter 应用之间的差距,增强了设计师与开发者之间的协作。

适合场景

  • 在Flutter应用中匹配Figma设计
  • 使用视觉网格对齐进行原型设计
  • 设计师与开发人员之间的协作
  • 确保用户界面布局中的一致性间距
  • 布局约束的视觉调试

主要特点

  • Figma 风格的网格系统
  • 实时视觉网格叠加
  • 支持列、间距和偏移
  • 跨平台兼容性
  • 通过 pub add 轻松集成
  • 可自定义的网格外观

适合对象

  • 使用 Flutter 的设计师
  • 遵循Figma设计的Flutter开发人员
  • 使用 Figma 进行 UI/UX 工作流的团队
  • 需要像素级布局对齐的项目
  • 专注于设计一致性的前端团队

使用建议

  • 网格仅用于视觉辅助,不用于布局逻辑
  • 不适用于生产环境的UI渲染
  • 如果过度使用,可能会影响性能
  • 应在发布版本中禁用
  • 需要为不同屏幕手动配置

原始 README

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

Figma layout grid

pub package  

figma_layout_grid is a Flutter package which imitates Figma's layout grid and all its functionalities. It helps you determine whether your UI components match the design file and align properly.

Basic usage

Wrap a widget with LayoutGrid in order to render a layout grid on top of it.

LayoutGrid(
    ...
    builder: (context) => Scaffold(),
)

Available layouts

This package supports three types of layout overlays - rows, columns and pixel grid.

Rows

Horizontal stripes with specified height, gutter, margin, offset, arrangement and color. There is a possibility for fixed rows count with passing desired number in a count parameter, otherwise rows are rendered dynamically due to the screen limits.

Example usage

LayoutGrid(
  ...
  rowsParams: const RowsParams(
    offset: 32.0,
    height: 16.0,
    gutter: 16.0,
  ),
  builder: (context) => Scaffold(),
),
rows example image
Columns

Vertical stripes with specified height, gutter, margin, offset, arrangement and color. There is a possibility for fixed columns count with passing desired number in a count parameter, otherwise columns are rendered dynamically due to the screen limits.

Example usage

LayoutGrid(
  ...
  columnsParams: const ColumnsParams(
    count: 4,
    width: 64.0,
    margin: 32.0,
  ),
  builder: (context) => Scaffold(),
),
columns example image
Grid

Square pixel grid with fixed spacing and color. The thickness of a grid is set to 1.

Example usage

LayoutGrid(
  ...
  gridParams: const GridParams(
    size: 50.0,
    color: Colors.black26,
  ),
  builder: (context) => Scaffold(),
),
grid example image

State management

By default all of the layouts are disabled. In order to manage layout grid state you may use LayoutGrid methods which are accessible via builder context.

Rows

void LayoutGrid.of(context).showRows() - shows row layout

void LayoutGrid.of(context).hideRows() - hides row layout

void LayoutGrid.of(context).toggleRows() - toggles row layout visibility

bool LayoutGrid.of(context).visibleRows - returns current row layout visibility state

Columns

void LayoutGrid.of(context).showColumns() - shows column layout

void LayoutGrid.of(context).hideColumns() - hides column layout

void LayoutGrid.of(context).toggleColumns() - toggles column layout visibility

bool LayoutGrid.of(context).visibleColumns - returns current column layout visibility state

Grid

void LayoutGrid.of(context).showGrid() - shows grid layout

void LayoutGrid.of(context).hideGrid() - hides grid layout

void LayoutGrid.of(context).toggleGrid() - toggles grid layout visibility

bool LayoutGrid.of(context).visibleGrid - returns current grid layout visibility state

Parametrization

As this package mimics Figma's layout grid features you can directly transfer desired outcome into corresponding parameters. The following example shows columns grid set with count = 10, height = 12, gutter = 12, offset = 24, bottom alignment and some custom color.

figma layout configuration

Which translates to this piece of code

LayoutGrid(
  ...
  rowsParams: RowsParams(
    count: 10,
    height: 12.0,
    gutter: 12.0,
    offset: 24.0,
    arrangement: RowsArragement.bottom,
    color: const Color(0xFF757975).withOpacity(0.15),
  ),
  builder: (context) => Scaffold(),
),

And finally to the following UI.

custom config

There is also a possibility to enable SafeArea for a specific layout.

Each of the three layers has optional SafeAreaParams within you can pass what SafeArea parts should be handled. The available options are top, bottom, left and right which correspond to SafeArea's parameters with the same names.

By default SafeArea feature is disabled.

LayoutGrid(
    ...
    rowsParams: const RowsParams(
      safeAreaParams: SafeAreaParams(
        bottom: true,
        top: true,
      ),
    ),
    columnsParams: const ColumnsParams(
      safeAreaParams: SafeAreaParams(
        right: true,
        left: true,
        top: true,
      ),
    ),
    builder: (context) => Scaffold(),
)

The above snippet will make the grid overlays avoid the device's intrusions.

safe area config

Demo

Try out the example app.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。