flutter_masonry_view 0.0.2 flutter_masonry_view: ^0.0.2 copied to clipboard
A flutter masonry grid layout to display a list of any number of columns. Also, it can be customized with the item padding and border radius.
import 'package:flutter/material.dart';
import 'package:flutter_masonry_view/flutter_masonry_view.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
fontFamily: 'Futura',
primarySwatch: Colors.teal,
),
home: Home(),
);
}
}
class Home extends StatelessWidget {
Home({Key? key}) : super(key: key);
final _items = [
'assets/images/1.jpeg',
'assets/images/2.jpeg',
'assets/images/3.jpeg',
'assets/images/4.jpeg',
'assets/images/5.jpeg',
'assets/images/6.jpeg',
'assets/images/7.jpeg',
'assets/images/8.jpeg',
'assets/images/9.jpg',
'assets/images/10.jpg',
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter Masonry View'),
),
body: SingleChildScrollView(
child: MasonryView(
listOfItem: _items,
numberOfColumn: 2,
itemBuilder: (item) {
return Image.asset(item);
},
),
),
);
}
}