Grid View
A representation of Layout Gtid.
NikuGridView
accepts all the props as same as GridView.
dart
// Using namespace
n.GridView()
.gridDelegate = delegate;
// Using Niku Prefix
NikuGridView()
.gridDelegate = delegate;
Example Usage
dart
n.GridView.count()
..count = 3 // CrossAxisCount
..ratio = 1
..children = List.generate(
items.length,
(index) => items[index].n,
)
..mainAxisSpacing = 8
..crossAxisSpacing = 8;
Using Builder
dart
n.GridView.builder()
..delegate = const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200,
)
..useItemBuilder((context, index) => value[index].n);
Using children
dart
n.GridView.count()
..delegate = const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200,
)
..children = List.generate(
items.length,
(index) => items[index].n,
);
Factory Method
Niku can accepts 6 factory method.
Factory Method | Equivalent Widget |
---|---|
n.GridView | GridView |
n.GridView.children | - |
n.GridView.builder | GridView.builder |
n.GridView.count | GridView.count |
n.GridView.custom | GridView.custom |
n.GridView.extent | GridView.extend |