|
|
|
@ -1,5 +1,7 @@ |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
|
|
typedef WidgetWrapper = Widget Function(Widget child); |
|
|
|
|
|
|
|
|
|
/// Provides utiulity widgets. |
|
|
|
|
abstract class UtilityWidgets { |
|
|
|
|
/// Conditionally wraps the [child] with [Tooltip] widget if [message] |
|
|
|
@ -8,4 +10,12 @@ abstract class UtilityWidgets { |
|
|
|
|
(message ?? '').isNotEmpty |
|
|
|
|
? Tooltip(message: message!, child: child) |
|
|
|
|
: child; |
|
|
|
|
|
|
|
|
|
/// Conditionally wraps the [child] with [wrapper] widget if [enabled] |
|
|
|
|
/// is true. |
|
|
|
|
static Widget maybeWidget( |
|
|
|
|
{required WidgetWrapper wrapper, |
|
|
|
|
required Widget child, |
|
|
|
|
bool enabled = false}) => |
|
|
|
|
enabled ? wrapper(child) : child; |
|
|
|
|
} |
|
|
|
|