transitionWidget property

Widget? get transitionWidget

Returns a Widget that is an exact copy of the widget which settings.parentKey is attached to, if that widget is of a supported type. If the widget is not a supported type this getter will return null.

If the widget type has gesture listeners, these will be disabled in the Widget that is returned.

Currently supported widgets include:

Implementation

Widget? get transitionWidget {
  final parentWidget = settings.parentKey?.currentWidget;

  /// Return null if [settings.parentKey] is null.
  if (parentWidget == null) return null;

  switch (parentWidget.runtimeType) {
    case ListTile:
      final widget = parentWidget as ListTile;
      return Material(
        type: MaterialType.transparency,
        child: ListTile(
          onTap: () => null,
          trailing: widget.trailing,
          title: widget.title,
          contentPadding: widget.contentPadding,
          isThreeLine: widget.isThreeLine,
          subtitle: widget.subtitle,
          leading: widget.leading,
          dense: widget.dense,
          enabled: widget.enabled,
          onLongPress: () => null,
          selected: widget.selected,
        ),
      );
    case Container:
      final widget = parentWidget as Container;
      return Container(
        alignment: widget.alignment,
        padding: widget.padding,
        decoration: widget.decoration,
        foregroundDecoration: widget.foregroundDecoration,
        width: renderBoxSize!.width,
        height: renderBoxSize!.height,
        constraints: widget.constraints,
        margin: widget.margin,
        transform: widget.transform,
        child: widget.child,
      );
    case FloatingActionButton:
      final widget = parentWidget as FloatingActionButton;
      if (widget.isExtended) return null;
      final backgroundColor = widget.backgroundColor ??
          Theme.of(transitionContext)
              .floatingActionButtonTheme
              .backgroundColor ??
          Theme.of(transitionContext).colorScheme.secondary;
      return Material(
        color: backgroundColor,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(56.0),
        ),
        child: Center(
          child: widget.child,
        ),
      );
    default:
      return null;
  }
}