使text.paint交互式[Flutter]

时间:2019-08-25 17:17:46

标签: flutter

我想使文本能够点击。但是我无法获得textSpan的位置。

我已经尝试用'rect'覆盖它,但是没有用。

void onTapDown(TapDownDetails d) {

 bool isHandled = false;

 if(!isHandled && /*get position of textSpan*/) {
   startButton.onTapDown();
   isHandled = true;
 }
}

//////

void render(Canvas c) {
painter.text = TextSpan(
  text: 'Begin the journey'.toUpperCase(),
  style: textStyle,
);

painter.layout();

position = Offset(
  (game.screenSize.width) - (painter.width * 3 + 40),
  (game.screenSize.height * .60) - (painter.height / 2),
);

painter.paint(c, position);
}

我想,当我单击要转到下一个视图的文本时。

0 个答案:

没有答案