some_widget_extensions 1.0.3 copy "some_widget_extensions: ^1.0.3" to clipboard
some_widget_extensions: ^1.0.3 copied to clipboard

Collection of convenience extensions to be used on widgets. It conserves Flutter's API making it as familiar as possible.

example/main.dart

// ignore_for_file: unused_local_variable

import 'package:flutter/material.dart';
import 'package:some_widget_extensions/widget.extensions.dart';
import 'package:some_widget_extensions/widget_list.extensions.dart';

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

  @override
  Widget build(BuildContext context) {
    throw UnimplementedError();
  }
}

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

  @override
  Widget build(BuildContext context) {
    throw UnimplementedError();
  }
}

void main() {
  // Imagine you have a few widgets that need to become a column...
  final traditionalColumnWidget = Column(
    mainAxisSize: MainAxisSize.min,
    children: [
      const Expanded(
        child: Padding(
          padding: EdgeInsets.only(bottom: 8.0),
          child: FirstWidget(),
        ),
      ),
      Container(
        constraints: const BoxConstraints(maxWidth: 145.0),
        child: const SecondWidget(),
      )
    ],
  );

  // ...using some_widget_extensions, this can become
  final lovelyColumnWidget = [
    const FirstWidget()
        .padding(padding: const EdgeInsets.only(bottom: 8.0))
        .expanded(),
    const SecondWidget()
        .container(constraints: const BoxConstraints(maxWidth: 145.0))
  ].column(mainAxisSize: MainAxisSize.min);
}
1
likes
160
points
86
downloads

Publisher

verified publisherbizjak.dev

Weekly Downloads

Collection of convenience extensions to be used on widgets. It conserves Flutter's API making it as familiar as possible.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on some_widget_extensions