Skip to content

Commit 2b05f02

Browse files
fix right border glitch
1 parent a874474 commit 2b05f02

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/features/searching/view_model/grid_notifier.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,16 @@ class SearchingNotifier extends StateNotifier<GridNotifierState> {
169169
if (_isBuildingGrid) return;
170170
_isBuildingGrid = true;
171171

172-
final index = _getIndex(addState: state, localPosition: event.localPosition);
172+
int index = _getIndex(addState: state, localPosition: event.localPosition);
173+
174+
/// when you try to draw on the right border if you make the arrow closly to the border it will draw the wall in the left side (the next index)
175+
/// those two lines to prevent that
176+
final calcIndex = (event.localPosition.dx / _gridSquareSize).floor();
177+
if (calcIndex != 0 &&
178+
calcIndex % state.columnCrossAxisCount == 0 &&
179+
index % state.columnCrossAxisCount == 0) {
180+
index--;
181+
}
173182

174183
/// to handle multi calls from listener widget
175184
if (index == state.currentTappedIndex) {

0 commit comments

Comments
 (0)