FlipClock constructor
FlipClock({
- Key? key,
- required double digitSize,
- required double width,
- required double height,
- AxisDirection flipDirection = AxisDirection.down,
- bool showSeconds = true,
- 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),
FlipClock constructor.
Parameters define clock digits and flip panel appearance.
- flipDirection defaults to AxisDirection.down.
- flipCurve defaults to FlipWidget.bounceFastFlip when direction is down, to FlipWidget.defaultFlip otherwise
- 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)
- hingeWidth defaults to 0.8
- hindeLength defaults to CrossAxis size
- hingeColor defaults to null (transparent)
- digitSpacing defaults to horizontal: 2.0
Implementation
FlipClock({
Key? key,
required double digitSize,
required double width,
required double height,
AxisDirection flipDirection = AxisDirection.down,
this.showSeconds = true,
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),
}) : assert(hingeLength == null || hingeWidth == 0.0 && hingeLength == 0.0 || hingeWidth > 0.0 && hingeLength > 0.0),
assert((borderWidth == null && borderColor == null) || (showBorder == null || showBorder == true)),
_displayBuilder = FlipClockBuilder(
digitSize: digitSize,
width: width,
height: height,
flipDirection: flipDirection,
flipCurve:
flipCurve ?? (flipDirection == AxisDirection.down ? FlipWidget.bounceFastFlip : FlipWidget.defaultFlip),
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,
),
super(key: key);