showTeachingTip<T extends Object?> function

Future<T?> showTeachingTip<T extends Object?>({
  1. required WidgetBuilder builder,
  2. required FlyoutController flyoutController,
  3. Alignment? nonTargetedAlignment,
  4. FlyoutPlacementMode placementMode = FlyoutPlacementMode.full,
  5. Duration? transitionDuration,
  6. FlyoutTransitionBuilder transitionBuilder = TeachingTip.defaultTransitionBuilder,
  7. Color? barrierColor = Colors.transparent,
  8. bool barrierDismissible = true,
})

Displays a Fluent teaching tip at the desired position, with Fluent entrance and exit animations, modal barrier color, and modal barrier behavior (dialog is dismissible with a tap on the barrier).

This function takes a builder, which typically builds a TeachingTip.

The context argument is used to look up the Navigator and FluentTheme for the dialog. It is only used when the method is called. Its corresponding widget can be safely removed from the tree before the dialog is closed.

The barrierDismissible argument is used to indicate whether tapping on the barrier will dismiss the dialog. It is true by default and can not be null.

The barrierColor argument is used to specify the color of the modal barrier that darkens everything below the dialog. If null the default color Colors.black54 is used.

The useSafeArea argument is used to indicate if the dialog should only display in 'safe' areas of the screen not used by the operating system (see SafeArea for more details). It is true by default, which means the dialog will not overlap operating system areas. If it is set to false the dialog will only be constrained by the screen size. It can not be null.

The useRootNavigator argument is used to determine whether to push the dialog to the Navigator furthest from or nearest to the given context. By default, useRootNavigator is true and the dialog route created by this method is pushed to the root navigator. It can not be null.

The routeSettings argument is passed to showGeneralDialog, see RouteSettings for details.

If the application has multiple Navigator objects, it may be necessary to call Navigator.of(context, rootNavigator: true).pop(result) to close the dialog rather than just Navigator.pop(context, result).

Returns a Future that resolves to the value (if any) that was passed to Navigator.pop when the dialog was closed.

State Restoration in Popups

Using this method will not enable state restoration for the dialog. In order to enable state restoration for a dialog, use Navigator.restorablePush or Navigator.restorablePushNamed with FluentDialogRoute.

For more information about state restoration, see RestorationManager.

See also:

Implementation

Future<T?> showTeachingTip<T extends Object?>({
  required WidgetBuilder builder,
  required FlyoutController flyoutController,
  Alignment? nonTargetedAlignment,
  FlyoutPlacementMode placementMode = FlyoutPlacementMode.full,
  Duration? transitionDuration,
  FlyoutTransitionBuilder transitionBuilder =
      TeachingTip.defaultTransitionBuilder,
  Color? barrierColor = Colors.transparent,
  bool barrierDismissible = true,
}) {
  return flyoutController.showFlyout<T>(
    placementMode: placementMode,
    transitionDuration: transitionDuration,
    transitionBuilder: TeachingTip.defaultTransitionBuilder,
    barrierColor: barrierColor,
    builder: (context) {
      final teachingTip = builder(context);

      if (nonTargetedAlignment != null) {
        return Align(
          alignment: nonTargetedAlignment,
          child: teachingTip,
        );
      }

      return teachingTip;
    },
  );
}