getOuterPath method

  1. @override
Path getOuterPath(
  1. Rect rect, {
  2. TextDirection? textDirection,
})
override

生成外轮廓路径

  1. 创建圆角矩形主体
  2. 根据offset/position计算箭头位置
  3. 组合路径形成对话框气泡形状 @return 包含箭头的气泡路径

Implementation

@override

/// 生成外轮廓路径
///
/// 1. 创建圆角矩形主体
/// 2. 根据offset/position计算箭头位置
/// 3. 组合路径形成对话框气泡形状
/// @return 包含箭头的气泡路径
Path getOuterPath(Rect rect, {TextDirection? textDirection}) {
  List<Offset> points = _randomPoints(limit: rect.width, count: 30)
      .reversed
      .map((e) => e.translate(0, rect.height - 10))
      .toList();
  points.add(Offset(0, 0));
  points.add(Offset(rect.width, 0));
  return PathExtra.sharpShape(points).shift(Offset(rect.left, rect.top));
}