mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-24 11:15:58 +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