FLUTTER ECOSYSTEM

abdulghani/masonry_grid

Flutter 拼貼網格實現

masonry_grid 專案封面
Stars
16
Forks
2
最近推送(UTC)
2025年2月14日
專案狀態
未封存
Ghani GitHub avatar
GITHUB User

Ghani ↗

Software Engineer

Jakarta, Indonesia
語言Dart

此儲存庫發佈的套件

使用的依賴

依賴清單 3 項
  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}
  • pedantic開發依賴^1.10.0

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 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