conditional_wrap
3.0.0, released 4 years ago by an unverified publisher
A Flutter widget that conditionally wraps a child subtree with a parent widget.
What it does
Provides a WidgetWrapper component that evaluates conditions inside a wrapper function to decide whether to wrap a child widget or return it unwrapped. It simplifies conditional UI structures without verbose if-else statements.
AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to apply a parent widget conditionally based on a boolean flag.
- You want to apply a wrapper only when a nullable value is present.
Skip it when
- You are managing complex app state or navigation.
- You prefer standard if-else widget creation directly in the build method.
Strengths
- Simplifies conditional UI wrapping logic
- Lightweight with no external dependencies other than Flutter
Weaknesses
- Does very little that cannot be achieved with standard Dart if-else expressions
- API has breaking changes across major versions
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
WidgetWrapper(
wrapper: (child) => _condition
? ParentWidget(child: child)
: child,
child: ChildSubtree(),
)Alternatives
Packages that do the same job and could replace conditional_wrap.
- conditional_parent_widget
Conditionally wrap a widget with a parent widget.
41Compare - defer_pointer
Provides a widget to render and hit‑test children outside their parent bounds.
50Compare - nested_overscroll
A widget that allows nested scrollable widgets to overscroll their parent.
50Compare - dpad_container
Dpad container focus navigation support for Android TV.
39Compare