buildWithErrorBoundary static method

Widget buildWithErrorBoundary({
  1. Key? key,
  2. required String message,
  3. required Widget child,
  4. Widget? fallback,
  5. FSTooltipVariant variant = FSTooltipVariant.primary,
  6. FSTooltipPlacement placement = FSTooltipPlacement.top,
  7. Duration showDelay = const Duration(milliseconds: 100),
  8. Duration hideDelay = const Duration(milliseconds: 100),
  9. Duration animationDuration = const Duration(milliseconds: 200),
  10. bool showArrow = true,
  11. double maxWidth = 200.0,
  12. EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
  13. TextStyle? textStyle,
  14. Color? backgroundColor,
  15. BorderRadiusGeometry? borderRadius,
  16. void onShowError(
    1. Object error
    )?,
  17. void onHideError(
    1. 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,
    ),
  );
}