swipe_path_typer

A swipe-based typing widget for Flutter, mimicking the gesture typing experience of modern mobile keyboards like Gboard or SwiftKey.

Ideal for games, puzzles, and creative UIs that need swipe input on a grid of characters.


โœจ Features

  • ๐Ÿ“ฑ Swipe over tiles to form words
  • ๐Ÿ”€ Sharp turn detection for smart letter selection
  • ๐Ÿ‘† Tap support (with optional auto-complete on tap)
  • ๐ŸŽจ Fully customizable tile UI
  • ๐Ÿงฑ Adjustable layout, spacing, and interaction
  • ๐Ÿ–Œ๏ธ Painted swipe trail (customizable color and thickness)
  • ๐Ÿ–ฑ๏ธ Desktop/web mouse support

๐Ÿš€ Usage

Basic

SwipePathTyper(
  tiles: ['h', 'e', 'l', 'l', 'o'],
  onSwipeCompleted: (word) {
    print('User typed: $word');
  },
  onLetterSelected: (letter){
    print('User selected $letter')
  }
)

Custom Tile Example

tileBuilder: (context, letter, isSelected) {
  return Container(
    padding: const EdgeInsets.all(12),
    decoration: BoxDecoration(
      color: isSelected ? Colors.blue : Colors.grey[200],
      borderRadius: BorderRadius.circular(10),
    ),
    child: Text(
      letter.toUpperCase(),
      style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
    ),
  );
},

โš™๏ธ Parameters

Parameter Type Description
tiles List<String> The list of characters to render as tiles
onSwipeCompleted ValueChanged<String> Called when a word is completed via swipe
onLetterSelected ValueChanged<String> Called when a letter is selected
tileBuilder TileBuilder? Optional builder to customize tile UI
columnCount int Number of tiles per row (default: 5)
simpleTapMode bool Taps immediately complete a word (default: true)
horizontalTileSpacing double Horizontal space between tiles
verticalTileSpacing double Vertical space between tile rows
padding EdgeInsets Padding around the entire widget
onPanUpdate Function(DragUpdateDetails)? Called during a swipe
onPanEnd Function(DragEndDetails)? Called when a swipe ends
onPanStart Function(DragEndDetails)? Called when a swipe starts
onTapDown Function(int)? Called when a tile is tapped down
onTapUp Function(int)? Called when a tile is tapped up
widgetHitTestBehavior HitTestBehavior Behavior for the gesture container
tileHitTestBehavior HitTestBehavior Behavior for mouse hover on tiles
tileCursor SystemMouseCursor Cursor to use on hover (e.g., click)
swipeTrailColor Color Color of the swipe trail
swipeTrailStrokeWidth double Thickness of the swipe trail line

๐Ÿงช Example

A working example is available in /example/main.dart.


๐Ÿ“ฆ Installation

Add to your pubspec.yaml:

dependencies:
  swipe_path_typer: ^1.1.5

๐Ÿ“„ License

MIT ยฉ 2025 Your Name or Studio

Libraries

swipe_path_typer
A Flutter package for swipe-based typing that mimics gesture typing on mobile keyboards.