conditional_wrap 0.0.1 copy "conditional_wrap: ^0.0.1" to clipboard
conditional_wrap: ^0.0.1 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 #

Simply wrap the widget subtree with a ConditionalWrap widget and pass the required properties.

ConditionalWrap(
  condition: shouldIncludeParent,
  positiveBuilder: (context, child) => ParentWidget(child: child),
  child: ChildSubtree(),
),

You can also provide an alternative builder to use when the condition is false.

ConditionalWrap(
  condition: shouldUsePositiveBuilder,
  positiveBuilder: (context, child) => ParentWidget(child: child),
  negativeBuilder: (context, child) => AlternativeParent(child: child),
  child: ChildSubtree(),
),
8
likes
160
points
957
downloads

Publisher

unverified uploader

Weekly Downloads

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