Skip to content

Instantly share code, notes, and snippets.

View vbuberen's full-sized avatar
🛠️

Volodymyr Buberenko vbuberen

🛠️
View GitHub Profile
@vbuberen
vbuberen / conditional_parent_widget.dart
Last active December 24, 2021 21:31 — forked from ltOgt/conditional_parent_widget.dart
Flutter Widget to conditionally wrap a subtree with some parent widget
import 'package:flutter/widgets.dart';
/// Conditionally wrap a subtree with a parent widget.
///
/// [isParentWidgetNeeded]: the condition depending on which the subtree [child] is wrapped with the parent.
/// [child]: The subtree that should always be build.
/// [conditionalBuilder]: builds the parent wrapping the subtree [child].
///
/// ___________
/// Usage: