Search packages, repositories and app categories

Package detailsv1.2.0

flex_list

A Flutter layout widget for flexible lists. It behaves as you would expect Expand widgets to behave within a wrap.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
1.8K
Likes
30
Pub points
150

Install package

flutter pub add flex_list

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

FlexList is a Flutter widget designed to create flexible, responsive lists that adapt dynamically within layout constraints. It functions similarly to how Expand widgets behave inside a Wrap, enabling items to grow and shrink based on available space. Ideal for creating fluid, scalable list layouts across different screen sizes and orientations, it enhances UI flexibility without complex custom coding. The package supports all major platforms, making it suitable for cross-platform applications requiring adaptive list behavior.

Use cases

  • Responsive list layouts
  • Dynamic item sizing
  • Cross-platform UI design
  • Adaptive content containers
  • Flexible grid-like lists
  • Nested layout integration

Key features

  • Auto-resizing list items
  • Supports all Flutter platforms
  • Intuitive wrap-like behavior
  • Minimal configuration required
  • Seamless integration with existing layouts
  • Consistent behavior across devices

Suitable for

  • Developers building responsive UIs
  • Apps needing adaptive list designs
  • Cross-platform projects
  • Layout-heavy applications
  • UI components requiring dynamic spacing

Considerations

  • May require careful alignment in complex nested structures
  • Performance impact with very large datasets
  • Limited customization beyond basic flex behavior
  • Not ideal for fixed-size or rigid layouts
  • Best suited for moderate list sizes
  • Depends on parent container constraints

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Flex List

Pub Points Pub Points Pub Points

Provides a flexible list layout that behaves as you would expect from Expand widgets within a Wrap.

Features

FlexList puts as many provided elements as possible in one row (like Wrap), but also extends the width of the elements by the remaining space per row. This means that each row is filled to the maximum width.

Getting started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  flex_list: <latest_version>

In your library add the following import:

import 'package:flex_list/flex_list.dart';

Usage

The following example shows how to use FlexList. Beside the children property, you can set horizontalSpacing and verticalSpacing to define the spacing between the elements.

Note: Both spacing values are 10 by default.

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'FlexList Demo',
        theme: ThemeData(),
        home: Scaffold(
          body: Center(
            child: SizedBox(
                width: 300,
                child: FlexList(
                  horizontalSpacing: 5,
                  verticalSpacing: 10,
                  children: [
                    for (var i = 0; i < 10; i++)
                      Container(
                        color: Theme
                            .of(context)
                            .colorScheme.surfaceContainer,
                        padding: EdgeInsets.symmetric(
                            horizontal: 20 + 20 * (i % 4), vertical: 10),
                        child: Text("Item $i"),
                      )
                  ],
                )),
          ),
        ));
  }
}
Rendering of above Example
Example Rendering

Additional information

This package was written because of the lack of such layout function. The package repository is maintained on Github and published on pub.dev

Categories

Source repository

Projects using this package