buildWithErrorBoundary static method
Widget
buildWithErrorBoundary({
- Key? key,
- required String message,
- required Widget child,
- Widget? fallback,
- FSTooltipVariant variant = FSTooltipVariant.primary,
- FSTooltipPlacement placement = FSTooltipPlacement.top,
- Duration showDelay = const Duration(milliseconds: 100),
- Duration hideDelay = const Duration(milliseconds: 100),
- Duration animationDuration = const Duration(milliseconds: 200),
- bool showArrow = true,
- double maxWidth = 200.0,
- EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
- TextStyle? textStyle,
- Color? backgroundColor,
- BorderRadiusGeometry? borderRadius,
- void onShowError(
- Object error
- void onHideError(
- Object error
Build tooltip with error boundary for graceful error handling
Implementation
static Widget buildWithErrorBoundary({
Key? key,
required String message,
required Widget child,
Widget? fallback,
FSTooltipVariant variant = FSTooltipVariant.primary,
FSTooltipPlacement placement = FSTooltipPlacement.top,
Duration showDelay = const Duration(milliseconds: 100),
Duration hideDelay = const Duration(milliseconds: 100),
Duration animationDuration = const Duration(milliseconds: 200),
bool showArrow = true,
double maxWidth = 200.0,
EdgeInsetsGeometry padding =
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
TextStyle? textStyle,
Color? backgroundColor,
BorderRadiusGeometry? borderRadius,
void Function(Object error)? onShowError,
void Function(Object error)? onHideError,
}) {
return ErrorBoundary(
// ✅ USING SHARED ERROR BOUNDARY
componentName: 'FlutstrapTooltip',
fallbackBuilder: (context) => fallback ?? child,
child: FlutstrapTooltip(
key: key,
message: message,
child: child,
variant: variant,
placement: placement,
showDelay: showDelay,
hideDelay: hideDelay,
animationDuration: animationDuration,
showArrow: showArrow,
maxWidth: maxWidth,
padding: padding,
textStyle: textStyle,
backgroundColor: backgroundColor,
borderRadius: borderRadius,
onShowError: onShowError,
onHideError: onHideError,
),
);
}