v1.0.0
masonry_grid
使用 Flutter Masonry Grid 布局创建马赛克、错落排列的项目布局。
45喜欢 715近 30 天下载130Pub 分数
AndroidiOSWebmacOSWindowsLinux
Flutter 拼贴网格实现
以下为英文项目原文快照,最新内容请访问 GitHub。
Flutter Masonry Grid layout to create masonry, staggered items layout.
Install the package, add the dependencies to your pubspec.yaml
dependencies:
// ... the rest of your dependencies
masonry_grid: [version]
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")),
)))
],
));
}
}
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
依赖清单 3 项
{"sdk":"flutter"}{"sdk":"flutter"}^1.10.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗