masonry_list_view_grid 1.0.0 copy "masonry_list_view_grid: ^1.0.0" to clipboard
masonry_list_view_grid: ^1.0.0 copied to clipboard

A new Flutter package that provides a masonry grid layout using list view.

example/main.dart

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:masonry_list_view_grid/masonry_list_view_grid.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Masonry List View Grid'),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(title),
      ),
      body: MasonryListViewGrid(
        column: 2,
        padding: const EdgeInsets.all(8.0),
        children: List.generate(
          100,
          (index) => Container(
            decoration: BoxDecoration(
              color: Color((Random().nextDouble() * 0xFFFFFF).toInt())
                  .withOpacity(0.5),
            ),
            height: (150 + (index % 3 == 0 ? 50 : 0)).toDouble(),
            child: Center(
              child: Text('Child ${index + 1}'),
            ),
          ),
        ),
      ),
    );
  }
}
13
likes
150
points
212
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter package that provides a masonry grid layout using list view.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, linked_scroll_controller

More

Packages that depend on masonry_list_view_grid