conditional_wrap 3.0.0 copy "conditional_wrap: ^3.0.0" to clipboard
conditional_wrap: ^3.0.0 copied to clipboard

A Flutter widget that allows you to conditionally wrap a child subtree with a parent widget

Flutter Conditional Wrap 🌯 #

Pub

A widget that allows you to conditionally wrap a child subtree with a parent widget

Usage #

Conditional Wrapping #

WidgetWrapper(
  wrapper: (child) => _condition
      ? ParentWidget(child: child)
      : child,
  child: ChildSubtree(),
),

Null Safe Wrapping #

WidgetWrapper(
  wrapper: (child) {
    final color = _color;
    return color != null
        ? ColoredBox(
            color: color,
            child: child,
          )
        : child;
  },
  child: Text('hello, friend.'),
),
4
likes
140
pub points
79%
popularity

Publisher

unverified uploader

A Flutter widget that allows you to conditionally wrap a child subtree with a parent widget

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on conditional_wrap