When you design an app that works both on mobile and on desktop, you should take into account the fact that some gestures are platform-specific. For instance, you cannot right-click with a mouse on a mobile device, but you can long-press.
In this recipe, you used the GestureDetector widget to select/deselect items in a GridView. You can use a GestureDetector both for touch screen gestures, such as swipes and long-presses, and for mouse gestures, such as right-click and scroll.
To select items and add a light-blue background color, you used an onTap event:
onTap: () => setColor(Colors.lightBlue, index),
onTap gets called both when the user taps with a finger on a touch screen and when they click on the main button of a mouse or stylus or any other pointing device. This is an example of a callback that works both on mobile and desktop.
To deselect an item, you used both onSecondaryTap and onLongPress:
onSecondaryTap: () => setColor(Colors.white, index...