Indicator constructor
const
Indicator({
- required double triggerOffset,
- required bool clamping,
- Duration processedDuration = const Duration(seconds: 1),
- bool safeArea = true,
- SpringDescription? spring,
- SpringDescription? horizontalSpring,
- SpringBuilder? readySpringBuilder,
- SpringBuilder? horizontalReadySpringBuilder,
- bool springRebound = true,
- FrictionFactor? frictionFactor,
- FrictionFactor? horizontalFrictionFactor,
- double? infiniteOffset,
- bool? hitOver,
- bool? infiniteHitOver,
- IndicatorPosition position = IndicatorPosition.above,
- double? secondaryTriggerOffset,
- bool hapticFeedback = false,
- double secondaryVelocity = kDefaultSecondaryVelocity,
- double? secondaryDimension,
- double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset,
- bool notifyWhenInvisible = false,
- IndicatorStateListenable? listenable,
- bool triggerWhenReach = false,
- bool triggerWhenRelease = false,
- bool triggerWhenReleaseNoWait = false,
- double maxOverOffset = double.infinity,
Implementation
const Indicator({
required this.triggerOffset,
required this.clamping,
this.processedDuration = const Duration(seconds: 1),
this.safeArea = true,
this.spring,
this.horizontalSpring,
this.readySpringBuilder,
this.horizontalReadySpringBuilder,
this.springRebound = true,
this.frictionFactor,
this.horizontalFrictionFactor,
this.infiniteOffset,
bool? hitOver,
bool? infiniteHitOver,
this.position = IndicatorPosition.above,
this.secondaryTriggerOffset,
this.hapticFeedback = false,
this.secondaryVelocity = kDefaultSecondaryVelocity,
this.secondaryDimension,
this.secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset,
this.notifyWhenInvisible = false,
this.listenable,
this.triggerWhenReach = false,
this.triggerWhenRelease = false,
this.triggerWhenReleaseNoWait = false,
this.maxOverOffset = double.infinity,
}) : hitOver = hitOver ?? infiniteOffset != null,
infiniteHitOver = infiniteHitOver ?? infiniteOffset == null,
assert(infiniteOffset == null || infiniteOffset >= 0,
'The infiniteOffset cannot be less than 0.'),
assert(infiniteOffset == null || !clamping,
'Cannot scroll indefinitely when clamping.'),
assert(!(hitOver == false && infiniteOffset != null),
'When hitOver is true, infinite scrolling cannot be used, please set infiniteHitOver.'),
assert(
secondaryTriggerOffset == null ||
secondaryTriggerOffset > triggerOffset,
'The secondaryTriggerOffset cannot be less than triggerOffset.'),
assert(!(infiniteOffset != null && secondaryTriggerOffset != null),
'Infinite scroll and secondary cannot be used together.'),
assert(
secondaryDimension == null ||
secondaryDimension > (secondaryTriggerOffset ?? 0),
'The secondaryDimension cannot be less than secondaryTriggerOffset.'),
assert(maxOverOffset == double.infinity || maxOverOffset >= 0,
'The maxOverOffset cannot be less than 0.');