FlipCountdownClock constructor

FlipCountdownClock({
  1. Key? key,
  2. required Duration duration,
  3. required double digitSize,
  4. required double width,
  5. required double height,
  6. AxisDirection flipDirection = AxisDirection.up,
  7. Curve? flipCurve,
  8. Color? digitColor,
  9. Color? backgroundColor,
  10. double? separatorWidth,
  11. Color? separatorColor,
  12. Color? separatorBackgroundColor,
  13. bool? showBorder,
  14. double? borderWidth,
  15. Color? borderColor,
  16. BorderRadius borderRadius = const BorderRadius.all(Radius.circular(4.0)),
  17. double hingeWidth = 0.8,
  18. double? hingeLength,
  19. Color? hingeColor,
  20. EdgeInsets digitSpacing = const EdgeInsets.symmetric(horizontal: 2.0),
  21. VoidCallback? onDone,
})

FlipCountdownClock constructor.

Parameters define clock digits and flip panel appearance.

  • flipDirection defaults to AxisDirection.up.
  • flipCurve defaults to null, that will deliver FlipWidget.defaultFlip.
  • digitColor and separatorColor defaults to colorScheme.onPrimary.
  • backgroundColor defauts to colorScheme.primary.
  • separatorWidth defaults to width / 3.
  • separatorColor defaults to colorScheme.onPrimary.
  • separatorBackground defaults to null (transparent).
  • showBorder can be set or defaults to true if boderColor or borderWidth is set
  • borderWidth defaults to 1.0 when a borderColor is set
  • borderColor defaults to colorScheme.onPrimary when a width is set.
  • borderRadius defaults to Radius.circular(4.0)
  • digitSpacing defaults to horizontal: 2.0
  • hingeWidth defaults to 0.8
  • hindeLength defaults to CrossAxis size
  • hingeColor defaults to null (transparent)

Implementation

FlipCountdownClock({
  Key? key,
  required this.duration,
  required double digitSize,
  required double width,
  required double height,
  AxisDirection flipDirection = AxisDirection.up,
  Curve? flipCurve,
  Color? digitColor,
  Color? backgroundColor,
  double? separatorWidth,
  Color? separatorColor,
  Color? separatorBackgroundColor,
  bool? showBorder,
  double? borderWidth,
  Color? borderColor,
  BorderRadius borderRadius = const BorderRadius.all(Radius.circular(4.0)),
  double hingeWidth = 0.8,
  double? hingeLength,
  Color? hingeColor,
  EdgeInsets digitSpacing = const EdgeInsets.symmetric(horizontal: 2.0),
  this.onDone,
})  : _showHours = duration.inHours > 0,
      _displayBuilder = FlipClockBuilder(
        digitSize: digitSize,
        width: width,
        height: height,
        flipDirection: flipDirection,
        flipCurve: flipCurve,
        digitColor: digitColor,
        backgroundColor: backgroundColor,
        separatorWidth: separatorWidth ?? width / 3.0,
        separatorColor: separatorColor,
        separatorBackgroundColor: separatorBackgroundColor,
        showBorder:
            showBorder ?? (borderColor != null || borderWidth != null),
        borderWidth: borderWidth,
        borderColor: borderColor,
        borderRadius: borderRadius,
        hingeWidth: hingeWidth,
        hingeLength: hingeWidth == 0.0
            ? 0.0
            : hingeLength ??
                (flipDirection == AxisDirection.down ||
                        flipDirection == AxisDirection.up
                    ? width
                    : height),
        hingeColor: hingeColor,
        digitSpacing: digitSpacing,
      );