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

Widget that arranges its children in a flexible wrap layout, allowing them to expand according to available space while maintaining the specified layout properties.

example/lib/main.dart

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flexible Wrap Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flexible Wrap Demo'),
    );
  }
}

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

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final padding = 8.0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: FlexibleWrap(
          isOneRowExpanded: true,
          spacing: 12.0,
          children: List.generate(20, (int index) {
            return Padding(
              padding: EdgeInsets.all(padding),
              child: Container(
                height: 100,
                width: 300,
                decoration: BoxDecoration(
                    color: Colors.blue,
                    borderRadius: BorderRadius.circular(8.0)),
                child: const Center(
                  child: ListTile(
                    title: Text(
                      "Lorem Ipsum is simply dummy text",
                      style: TextStyle(color: Colors.white),
                      overflow: TextOverflow.ellipsis,
                    ),
                    subtitle: Text(
                      "Lorem Ipsum has been the industry's standard",
                      style: TextStyle(color: Colors.white),
                      overflow: TextOverflow.ellipsis,
                    ),
                    leading: Icon(
                      Icons.insert_emoticon,
                      color: Colors.white,
                      size: 60.0,
                    ),
                    trailing: Icon(
                      Icons.favorite,
                      color: Colors.white,
                    ),
                  ),
                ),
              ),
            );
          }).toList(),
        ),
      ),
    );
  }
}
22
likes
160
pub points
84%
popularity

Publisher

verified publisherbixat.dev

Widget that arranges its children in a flexible wrap layout, allowing them to expand according to available space while maintaining the specified layout properties.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flexible_wrap