搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.0

masonry_grid

使用 Flutter Masonry Grid 布局建立馬賽克、錯落排列的項目佈局。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
715
喜歡數
45
Pub 分數
130

安裝套件

flutter pub add masonry_grid

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

MasonryGrid 是一個 Flutter 套件,讓開發者能輕鬆建立馬賽克或錯落的網格佈局。它允許不同高度的項目以視覺上吸引人的非均勻網格模式排列,非常適合用於相簿、產品清單和內容流。該佈局會動態適應不同的螢幕尺寸,並在所有平台支援平滑捲動。此元件注重效能與彈性,可無縫整合至現有的 Flutter 專案中。

適用情境

  • 照片畫廊
  • 產品清單
  • 內容提要
  • 動態項目佈局
  • 響應式設計

主要特色

  • 交錯項目排列
  • 可變項目高度
  • 跨平台支援
  • 平滑滾動
  • 輕鬆整合

適合對象

  • 開發視覺內容應用的開發者
  • 需要動態網格的專案
  • 針對多個平台的應用程式
  • 尋求靈活版面的設計人員

使用建議

  • 可能需要自訂高度計算
  • 性能取決於項目數量
  • 有限的內建自定選項
  • 最適合靜態或可預測的資料集

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

masonry_grid

Flutter Masonry Grid layout to create masonry, staggered items layout.

Getting Started

Install the package, add the dependencies to your pubspec.yaml

dependencies:
  // ... the rest of your dependencies
  masonry_grid: [version]

Usage

Import and use the widget to create your grid

import 'package:masonry_grid/masonry_grid.dart';

class YourPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: CustomScrollView(
      slivers: [
        SliverToBoxAdapter(
            child: MasonryGrid(
                column: 2,
                children: List.generate(10, (i) =>
                      SizedBox(width: 100, height: 100, child: Text("hello")),
                )))
      ],
    ));
  }
}

Properties

int column  // number of column rendered
List<Widget> children // children widgets that's going to be rendered.
double mainAxisSpacing  // amount of vertical spacing between items
double crossAxisSpacing // amount of horizontal spacing between columns
bool staggered  //  stagger layout to override children order to paint items on the lowest column first
CrossAxisAlignment crossAxisAlignment // cross axis alignment inside of each column

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。