handleHero method

  1. @protected
Widget handleHero(
  1. BuildContext context,
  2. Widget widget,
  3. WidgetNodeSpec spec
)

Handles convenience 'hero' property.

Implementation

@protected
Widget handleHero(BuildContext context, Widget widget, WidgetNodeSpec spec) {
  if (spec.props["heroTag"] != null) {
    final hero = Hero(
        tag: spec.props["heroTag"],
        child: Material(type: MaterialType.transparency, child: widget));
    if (widget is PreferredSizeWidget) {
      widget = PreferredSize(
        preferredSize: Size.fromHeight(widget.preferredSize.height),
        child: hero,
      );
    } else {
      widget = hero;
    }
  }
  return widget;
}