proper conditional parent widget class to handle some desktop/mobile differences in a cleaner manner

This commit is contained in:
julian 2022-10-31 11:32:22 -06:00
parent b3b8d0b057
commit 817460b5e1

View 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;
}
}
}