mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
proper conditional parent widget class to handle some desktop/mobile differences in a cleaner manner
This commit is contained in:
parent
b3b8d0b057
commit
817460b5e1
1 changed files with 23 additions and 0 deletions
23
lib/widgets/conditional_parent.dart
Normal file
23
lib/widgets/conditional_parent.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ConditionalParent extends StatelessWidget {
|
||||
const ConditionalParent({
|
||||
Key? key,
|
||||
required this.condition,
|
||||
required this.child,
|
||||
required this.builder,
|
||||
}) : super(key: key);
|
||||
|
||||
final bool condition;
|
||||
final Widget child;
|
||||
final Widget Function(Widget) builder;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (condition) {
|
||||
return builder(child);
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue