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.
-
Customizable Crossword Widget: The package offers a customizable crossword widget that can be easily integrated into any Flutter app. You can adjust the widget's appearance, size, and layout to match your app's design and theme.
-
User-Friendly Interface: The user interface is designed with simplicity and ease of use in mind. Users can intuitively navigate through the puzzle, pan, and select the letters to choose words.
-
Clue Management: Manage crossword clues effortlessly with this package by passing the list of words into the
Crossword
widget.
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.
To get started add the Crossword
widget.
letters
: takes all the letters as a two-dimentionalList
spacing
: controls thehorizontal
andvertical
spacing in between letters theCrossword panel
hints
: takes aList
of words as clues
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"],
)
initialLineList
: Accepts aList
ofLineOffset
to add initial lines to the crossword -- ALineOffset
is a class that takes thestart
andend
positions of the lineacceptReversedDirection
: accepts abool
to identify while creating the words by touching in the reversed direction, is enabled or notdrawCrossLine
: accepts abool
, and identifies if the user can interact in theCross
direction or not.drawVerticalLine
: accepts abool
, and identifies if the user can interact in theVertical
direction or not.drawHorizontalLine
: accepts abool
, and identifies if the user can interact in theHorizontal
direction or not.
drawCrossLine
,drawVerticalLine
,drawHorizontalLine
can't be set asfalse
altogether.
lineDecoration
: Decorate lines to update colors based on the input and cluestextStyle
: Add styles to the crossword letterstransposeMatrix
: Transpose the 2x2 matrixalowOverlap
: Accepts abool
to identify if the user can overlap the words or notaddIncorrectWord
: Accepts abool
to identify if the user can draw incorrect lines or not
lineGradientColors
: Accepts aList
ofList
ofColors
to update the gradient colors of the lines.incorrectGradientColors
: Accepts aList
ofColors
to update the gradient colors of the lines when the user draws an incorrect line.correctGradientColors
: Accepts aList
ofColors
to update the gradient colors of the lines when the user draws a correct line.strokeWidth
: Accepts adouble
to update the width of the lines.strokeCap
: Accepts aStrokeCap
to update the stroke cap of the lines.lineTextStyle
: Accepts aTextStyle
to update the style of the words which are drawn by the user.
- Use a Global Key to access the
Crossword
widget and call theanimate
method to animate the letter decoration.
final GlobalKey<CrosswordState> _crosswordState = GlobalKey();
- Pass the
GlobalKey
to theCrossword
widget
Crossword(key: _crosswordState);
- Access the
Crossword
widget using the global key and call theanimate
method to animate the letter
//offset is the position of the letter in the crossword
crosswordState.currentState!.animate(offset: const Offset(7, 3));
-
revealLetterDecoration
: Accepts aRevealLetterDecoration
to animate the decoration of the letters -
'letterPopDecoration': Accepts a
LetterPopDecoration
to animate the decoration of the specific letter onTouchEvent
Contributions are welcome! If you find a bug or want to add a feature, please file an issue