FlipFraseBoard constructor

FlipFraseBoard({
  1. Key? key,
  2. required FlipType flipType,
  3. required Axis axis,
  4. String? startFrase,
  5. String? startLetter,
  6. required String endFrase,
  7. List<Color>? letterColors,
  8. List<Color>? startColors,
  9. List<Color>? endColors,
  10. required double fontSize,
  11. double? flipLetterWidth,
  12. double? flipLetterHeight,
  13. bool? showBorder,
  14. double? borderWidth,
  15. Color? borderColor,
  16. double hingeWidth = 0.0,
  17. double? hingeLength,
  18. Color? hingeColor,
  19. double letterSpacing = 1.0,
  20. int minFlipDelay = 250,
  21. int maxFlipDelay = 600,
  22. VoidCallback? onDone,
  23. ValueNotifier<int>? startNotifier,
})

FlipFraseBoard constructor.

The start letter may be given for each letter with a startFrase or a start letter may be set to build a startFrase with all letters equal. StartFrase and endFrase must have the same length.

Colors parameters for startColors and endColors can have any number of colors, if fewer colors are given they will be cycled to define start/end colors for each letter.

Parameters customize size, colors, spacing, border, hinge and flip delay randomization.

There is an optional callback parameter for onDone event, and an optional parameter for a ValueNotifier to signal a restart of the whole animation.

Implementation

FlipFraseBoard({
  Key? key,
  required this.flipType,
  required this.axis,
  String? startFrase,
  String? startLetter,
  required String endFrase,
  this.letterColors,
  this.startColors,
  this.endColors,
  required this.fontSize,
  double? flipLetterWidth,
  double? flipLetterHeight,
  this.showBorder,
  this.borderWidth,
  this.borderColor,
  this.hingeWidth = 0.0,
  double? hingeLength,
  this.hingeColor,
  this.letterSpacing = 1.0,
  this.minFlipDelay = 250,
  this.maxFlipDelay = 600,
  this.onDone,
  ValueNotifier<int>? startNotifier,
})  : assert(startFrase == null || startLetter == null),
      assert(startFrase != null && startFrase.isNotEmpty ||
          startLetter != null && startLetter.length == 1),
      assert(endFrase.isNotEmpty),
      assert(startFrase == null || startFrase.length == endFrase.length),
      assert(endColors == null || endColors.isNotEmpty),
      assert(hingeLength == null ||
          hingeLength == 0.0 && hingeWidth == 0.0 ||
          hingeLength != 0.0 && hingeWidth != 0.0),
      assert(hingeColor == null || hingeWidth != 0.0),
      assert(minFlipDelay <= maxFlipDelay),
      _startChars = startFrase?.characters ??
          (startLetter! * endFrase.length).characters,
      _endChars = endFrase.characters,
      flipLetterWidth = flipLetterWidth ?? fontSize + 4,
      flipLetterHeight = flipLetterHeight ?? fontSize + 6,
      hingeLength = hingeLength ??
          (hingeWidth == 0.0
              ? 0.0
              : (axis == Axis.vertical ? fontSize + 4 : fontSize + 6)),
      startNotifier = startNotifier ?? ValueNotifier(0),
      super(key: key) {
  _clearDoneList();
}