getDefaultTooltip method

Widget getDefaultTooltip(
  1. PreferOrientation preferOri,
  2. Animation<double>? animation
)

Handling Tooltip widget sequence.

You can decide whether to override as needed.

Implementation

Widget getDefaultTooltip(
    PreferOrientation preferOri, Animation<double>? animation) {
  Widget defComputed = getDefaultComputed(animation);
  Widget result;
  Widget tipPainter = customTipPainter();

  /// CustomSingleChildLayout可以获取父组件和子组件的布局区域。并可以对子组件进行盒约束及偏移定位。一句话来说用于排布一个组件
  switch (preferOri) {
    case PreferOrientation.right:
      result = Row(mainAxisSize: MainAxisSize.min, children: [
        tipPainter,
        Flexible(
          fit: FlexFit.loose,
          child: defComputed,
        )
      ]);
      break;
    case PreferOrientation.left:
      result = Row(mainAxisSize: MainAxisSize.min, children: [
        Flexible(
          fit: FlexFit.loose,
          child: defComputed,
        ),
        tipPainter,
      ]);
      break;
    case PreferOrientation.down:
      result = Column(mainAxisSize: MainAxisSize.min, children: [
        tipPainter,
        defComputed,
      ]);
      break;
    default:
      result = Column(mainAxisSize: MainAxisSize.min, children: [
        defComputed,
        tipPainter,
      ]);
  }
  return result;
}