diff --git a/analysis_options.yaml b/analysis_options.yaml index 1336595b..f3c57469 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -8,6 +8,8 @@ analyzer: argument_type_not_assignable: error invalid_assignment: error dead_code: warning + overridden_fields: ignore + use_key_in_widget_constructors: ignore linter: rules: diff --git a/example/lib/main.dart b/example/lib/main.dart index d64a1a68..a4323db0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -184,7 +184,7 @@ class _MailPageState extends State { disableDefaultTargetGestures: true, child: GestureDetector( onTap: () => - print('menu button clicked'), + debugPrint('menu button clicked'), child: Icon( Icons.menu, color: Theme.of(context).primaryColor, diff --git a/lib/src/layout_overlays.dart b/lib/src/layout_overlays.dart index 7cd48ca3..da3b6810 100644 --- a/lib/src/layout_overlays.dart +++ b/lib/src/layout_overlays.dart @@ -173,12 +173,10 @@ class _OverlayBuilderState extends State { void addToOverlay(OverlayEntry overlayEntry) async { final showCaseContext = ShowCaseWidget.of(context).context; if (mounted) { - if (Overlay.of(showCaseContext) != null) { - Overlay.of(showCaseContext)!.insert(overlayEntry); - } else { - if (Overlay.of(context) != null) { - Overlay.of(context)!.insert(overlayEntry); - } + try { + Overlay.of(showCaseContext).insert(overlayEntry); + } catch (e) { + Overlay.of(context).insert(overlayEntry); } } } diff --git a/lib/src/tooltip_widget.dart b/lib/src/tooltip_widget.dart index caaba8fc..7ec91789 100644 --- a/lib/src/tooltip_widget.dart +++ b/lib/src/tooltip_widget.dart @@ -118,10 +118,14 @@ class _ToolTipWidgetState extends State position.dy + ((widget.position?.getHeight() ?? 0) / 2); final topPosition = position.dy - ((widget.position?.getHeight() ?? 0) / 2); final hasSpaceInTop = topPosition >= height; + final EdgeInsets viewInsets = EdgeInsets.fromWindowPadding( + WidgetsBinding.instance.window.viewInsets, + WidgetsBinding.instance.window.devicePixelRatio); + final double actualVisibleScreenHeight = + (widget.screenSize?.height ?? MediaQuery.of(context).size.height) - + viewInsets.bottom; final hasSpaceInBottom = - ((widget.screenSize?.height ?? MediaQuery.of(context).size.height) - - bottomPosition) >= - height; + (actualVisibleScreenHeight - bottomPosition) >= height; return widget.tooltipPosition ?? (hasSpaceInTop && !hasSpaceInBottom ? TooltipPosition.top @@ -132,12 +136,12 @@ class _ToolTipWidgetState extends State final titleStyle = widget.titleTextStyle ?? Theme.of(context) .textTheme - .headline6! + .titleLarge! .merge(TextStyle(color: widget.textColor)); final descriptionStyle = widget.descTextStyle ?? Theme.of(context) .textTheme - .subtitle2! + .titleSmall! .merge(TextStyle(color: widget.textColor)); final titleLength = widget.title == null ? 0 @@ -424,7 +428,7 @@ class _ToolTipWidgetState extends State style: widget.titleTextStyle ?? Theme.of(context) .textTheme - .headline6! + .titleLarge! .merge( TextStyle( color: widget.textColor, @@ -441,7 +445,7 @@ class _ToolTipWidgetState extends State style: widget.descTextStyle ?? Theme.of(context) .textTheme - .subtitle2! + .titleSmall! .merge( TextStyle( color: widget.textColor,