BranchedParent class

This commit is contained in:
julian 2022-11-09 12:58:38 -06:00
parent 6d0452debb
commit af47c67231

View file

@ -21,3 +21,27 @@ class ConditionalParent extends StatelessWidget {
}
}
}
class BranchedParent extends StatelessWidget {
const BranchedParent({
Key? key,
required this.condition,
required this.conditionBranchBuilder,
required this.otherBranchBuilder,
required this.children,
}) : super(key: key);
final bool condition;
final Widget Function(List<Widget>) conditionBranchBuilder;
final Widget Function(List<Widget>) otherBranchBuilder;
final List<Widget> children;
@override
Widget build(BuildContext context) {
if (condition) {
return conditionBranchBuilder(children);
} else {
return otherBranchBuilder(children);
}
}
}