mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-26 11:17:22 +08:00
24 lines
446 B
Dart
24 lines
446 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class OptionalWrapper extends StatelessWidget {
|
|
const OptionalWrapper({
|
|
required this.enabled,
|
|
required this.wrapper,
|
|
required this.child,
|
|
super.key,
|
|
});
|
|
|
|
final bool enabled;
|
|
final Widget Function(Widget) wrapper;
|
|
final Widget child;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (enabled) {
|
|
return wrapper(child);
|
|
} else {
|
|
return child;
|
|
}
|
|
}
|
|
}
|