Amonc / crossword

Crossword is a comprehensive solution for seamlessly integrating a crossword puzzle-solving user interface into your Flutter app. With this package, you can effortlessly provide users with an interactive and enjoyable crossword puzzle-solving experience within your application
https://pub.dev/packages/crossword
MIT License
7 stars 3 forks source link
animation dart dart-package flutter game puzzle ui word word-puzzle

NEW: LetterPop Animation

Crossword pub package


GitHub commit activity GitHub contributors GitHub Repo stars GitHub Pub Version Pub Likes Pub Points Pub Popularity


Crossword is a comprehensive solution for seamlessly integrating a crossword puzzle-solving user interface into your Flutter app. With this package, you can effortlessly provide users with an interactive and enjoyable crossword puzzle-solving experience within your application.

Features

Getting started

Installation

You just need to add crossword as a dependency in your pubspec.yaml file.

dependencies:
  crossword: ^1.3.1

Import the package in your Dart code and instantiate the Crossword widget.

Example

To get started add the Crossword widget.

Crossword(
   letters: const [
       ["F", "L", "U", "T", "T", "E", "R", "W", "U", "D", "B", "C"],
       ["R", "M", "I", "O", "P", "U", "I", "Q", "R", "L", "E", "G"],
       ["T", "V", "D", "I", "R", "I", "M", "U", "A", "H", "E", "A"],
       ["D", "A", "R", "T", "N", "S", "T", "O", "Y", "J", "R", "M"],
       ["O", "G", "A", "M", "E", "S", "C", "O", "L", "O", "R", "O"],
       ["S", "R", "T", "I", "I", "I", "F", "X", "S", "P", "E", "D"],
       ["Y", "S", "N", "E", "T", "M", "M", "C", "E", "A", "T", "S"],
       ["W", "E", "T", "P", "A", "T", "D", "Y", "L", "M", "N", "U"],
       ["O", "T", "E", "H", "R", "O", "G", "P", "T", "U", "O", "E"],
       ["K", "R", "R", "C", "G", "A", "M", "E", "S", "S", "T", "S"],
       ["S", "E", "S", "T", "L", "A", "O", "P", "U", "P", "E", "S"]
   ],
   spacing: const Offset(30, 30),
   onLineDrawn: (List<String> words) {},
   textStyle: const TextStyle(
   color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold),
   lineDecoration: const LineDecoration(
      lineGradientColors: [
         [Colors.blue, Colors.black, Colors.red],
         [Colors.orange, Colors.black],
      ],
      strokeWidth: 26,
      lineTextStyle: TextStyle(
        color: Colors.white, fontSize: 16, 
        fontWeight: FontWeight.bold),
      ),
    hints: const ["FLUTTER", "GAMES", "UI", "COLORS"],
)

Additional parameters

drawCrossLine, drawVerticalLine, drawHorizontalLine can't be set as false altogether.

Line Decoration - parameters

Reveal Letter Animation

final GlobalKey<CrosswordState> _crosswordState = GlobalKey();
 Crossword(key: _crosswordState);
//offset is the position of the letter in the crossword
 crosswordState.currentState!.animate(offset: const Offset(7, 3));

Contributions

Contributions are welcome! If you find a bug or want to add a feature, please file an issue