From 91e6d460a5a86ba648b6e975dd091e90a138d47e Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 15 Nov 2020 09:23:48 +0800 Subject: [PATCH] =?UTF-8?q?flutter:=20=E9=87=8D=E6=9E=84=20GestureDetector?= =?UTF-8?q?()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/flutter/lib/board/board_widget.dart | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ui/flutter/lib/board/board_widget.dart b/src/ui/flutter/lib/board/board_widget.dart index b8c30b8b..bea1a07c 100644 --- a/src/ui/flutter/lib/board/board_widget.dart +++ b/src/ui/flutter/lib/board/board_widget.dart @@ -76,18 +76,25 @@ class BoardWidget extends StatelessWidget { final gridWidth = (width - padding * 2); final squareWidth = gridWidth / 7; - final dx = d.localPosition.dx, dy = d.localPosition.dy; - final row = (dy - padding - digitsHeight) ~/ squareWidth; + final dx = d.localPosition.dx; + final dy = d.localPosition.dy; + final column = (dx - padding) ~/ squareWidth; + if (column < 0 || column > 6) { + print("Tap on column $column skip"); + return; + } + + final row = (dy - padding - digitsHeight) ~/ squareWidth; + if (row < 0 || row > 6) { + print("Tap on row $row skip"); + return; + } final index = row * 7 + column; print("Tap on ($row, $column) <$index>"); - if (row < 0 || row > 6) return; - - if (column < 0 || column > 6) return; - onBoardTap(context, index); }, );