Skip to content
On this page

List Tile

List View demo

A representation of Lists.

NikuListView accepts all the props as same as ListView.

// Using namespace
n.ListView.children([]);

// Using Niku Prefix
NikuListView.children([]);

Example Usage

n.ListView.children([
    "1".n,
    "2".n,
    "3".n,
]);

Using Builder

n.ListView.builder()
    ..total = 100
    ..useItemBuilder(
      (context, index) => n.ListTile()
        ..title = n.Text(index.n)
        ..dense = true,
    );

Using Separated

n.ListView.separated()
    ..total = 100
    ..useItemBuilder(
      (context, index) => n.ListTile()
        ..title = n.Text(index.n)
        ..subtitle = n.Text(index.n)
    )
    ..useSeparatorBuilder((context, index) => Divider(height: 1));

ShrinkWrap

Use shrinkWrap when you are placing ListView inside dynamic height layout like Scrollable

n.Column([
    n.ListView.builder()
        ..total = 10
        ..useItemBuilder((context, index) => n.ListTile()
            ..title = n.Text(index.n)
        )
        ..shrinkWrap;
])
    ..scrollable;

Factory Method

Niku can accepts 5 factory method.

Factory MethodEquivalent Widget
n.ListViewListView
n.ListView.children-
n.ListView.builderListView.builder
n.ListView.separatedListView.separated
n.ListView.customListView.custom

Defination

View Defination on pub.dev