mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-08 19:59:29 +00:00
BranchedParent class
This commit is contained in:
parent
6d0452debb
commit
af47c67231
1 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue