From 690294d598542c0395e2ee31b6f5865e96b6e3ab Mon Sep 17 00:00:00 2001 From: xuelong Date: Mon, 29 Apr 2024 18:28:52 +0800 Subject: [PATCH] style: use_super_parameters. --- lib/src/easy_paging.dart | 4 +- lib/src/easy_refresh.dart | 16 +- lib/src/indicator/footer/footer.dart | 294 ++++++------------ lib/src/indicator/footer/footer_locator.dart | 20 +- lib/src/indicator/header/header.dart | 294 ++++++------------ lib/src/indicator/header/header_locator.dart | 20 +- lib/src/notifier/indicator_notifier.dart | 24 +- lib/src/painter/paths_painter.dart | 4 +- lib/src/physics/scroll_physics.dart | 5 +- lib/src/styles/bezier/bezier_background.dart | 4 +- .../bezier/bezier_circle_indicator.dart | 4 +- lib/src/styles/bezier/bezier_indicator.dart | 4 +- .../styles/bezier/footer/bezier_footer.dart | 42 +-- .../bezier/header/bezier_circle_header.dart | 36 +-- .../styles/bezier/header/bezier_header.dart | 42 +-- lib/src/styles/bezier/spin/hour_glass.dart | 4 +- lib/src/styles/classic/classic_indicator.dart | 5 +- .../styles/classic/footer/classic_footer.dart | 51 +-- .../styles/classic/header/classic_header.dart | 2 +- .../cupertino_activity_indicator.dart | 10 +- .../styles/cupertino/cupertino_indicator.dart | 4 +- .../cupertino/footer/cupertino_footer.dart | 42 +-- .../cupertino/header/cupertino_header.dart | 42 +-- .../styles/delivery/delivery_indicator.dart | 4 +- .../delivery/footer/delivery_footer.dart | 33 +- .../delivery/header/delivery_header.dart | 33 +- .../material/footer/material_footer.dart | 39 +-- .../material/header/material_header.dart | 39 +-- .../styles/material/material_indicator.dart | 4 +- .../styles/phoenix/footer/phoenix_footer.dart | 42 +-- .../styles/phoenix/header/phoenix_header.dart | 42 +-- lib/src/styles/phoenix/phoenix_indicator.dart | 4 +- .../styles/taurus/footer/taurus_footer.dart | 36 +-- .../styles/taurus/header/taurus_header.dart | 36 +-- lib/src/styles/taurus/taurus_indicator.dart | 4 +- 35 files changed, 445 insertions(+), 844 deletions(-) diff --git a/lib/src/easy_paging.dart b/lib/src/easy_paging.dart index 71e6af23..f2c3fe15 100644 --- a/lib/src/easy_paging.dart +++ b/lib/src/easy_paging.dart @@ -68,7 +68,7 @@ abstract class EasyPaging extends StatefulWidget { final WidgetBuilder? emptyWidgetBuilder; const EasyPaging({ - Key? key, + super.key, this.useDefaultPhysics = false, this.controller, this.spring, @@ -87,7 +87,7 @@ abstract class EasyPaging extends StatefulWidget { this.itemBuilder, this.refreshOnStartWidgetBuilder, this.emptyWidgetBuilder, - }) : super(key: key); + }); @override EasyPagingState createState(); diff --git a/lib/src/easy_refresh.dart b/lib/src/easy_refresh.dart index 0c8f967c..35f2e184 100644 --- a/lib/src/easy_refresh.dart +++ b/lib/src/easy_refresh.dart @@ -32,10 +32,10 @@ class _InheritedEasyRefresh extends InheritedWidget { final EasyRefreshData data; const _InheritedEasyRefresh({ - Key? key, + super.key, required this.data, - required Widget child, - }) : super(key: key, child: child); + required super.child, + }); @override bool updateShouldNotify(covariant _InheritedEasyRefresh oldWidget) => @@ -179,7 +179,7 @@ class EasyRefresh extends StatefulWidget { ERScrollBehavior(physics); const EasyRefresh({ - Key? key, + super.key, required this.child, this.controller, this.header, @@ -207,11 +207,10 @@ class EasyRefresh extends StatefulWidget { assert(callRefreshOverOffset > 0, 'callRefreshOverOffset must be greater than 0.'), assert(callLoadOverOffset > 0, - 'callLoadOverOffset must be greater than 0.'), - super(key: key); + 'callLoadOverOffset must be greater than 0.'); const EasyRefresh.builder({ - Key? key, + super.key, required this.childBuilder, this.controller, this.header, @@ -239,8 +238,7 @@ class EasyRefresh extends StatefulWidget { assert(callRefreshOverOffset > 0, 'callRefreshOverOffset must be greater than 0.'), assert(callLoadOverOffset > 0, - 'callLoadOverOffset must be greater than 0.'), - super(key: key); + 'callLoadOverOffset must be greater than 0.'); @override State createState() => _EasyRefreshState(); diff --git a/lib/src/indicator/footer/footer.dart b/lib/src/indicator/footer/footer.dart index 64f3106a..dc3fb6e9 100644 --- a/lib/src/indicator/footer/footer.dart +++ b/lib/src/indicator/footer/footer.dart @@ -3,60 +3,33 @@ part of '../../../easy_refresh.dart'; /// Footer indicator. abstract class Footer extends Indicator { const Footer({ - required double triggerOffset, - required bool clamping, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - SpringBuilder? readySpringBuilder, - SpringBuilder? horizontalReadySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool safeArea = true, - double? infiniteOffset = 0, - bool? hitOver, - bool? infiniteHitOver, - IndicatorPosition position = IndicatorPosition.above, - bool hapticFeedback = false, - double? secondaryTriggerOffset, - 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, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - horizontalSpring: horizontalSpring, - readySpringBuilder: readySpringBuilder, - horizontalReadySpringBuilder: horizontalReadySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - notifyWhenInvisible: notifyWhenInvisible, - listenable: listenable, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - triggerWhenReleaseNoWait: triggerWhenReleaseNoWait, - maxOverOffset: maxOverOffset, - ); + required super.triggerOffset, + required super.clamping, + super.processedDuration, + super.spring, + super.horizontalSpring, + super.readySpringBuilder, + super.horizontalReadySpringBuilder, + super.springRebound, + super.frictionFactor, + super.horizontalFrictionFactor, + super.safeArea, + super.infiniteOffset = 0, + super.hitOver, + super.infiniteHitOver, + super.position, + super.hapticFeedback, + super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.notifyWhenInvisible, + super.listenable, + super.triggerWhenReach, + super.triggerWhenRelease, + super.triggerWhenReleaseNoWait, + super.maxOverOffset, + }); } /// Build footer widget use [IndicatorBuilder]. @@ -66,60 +39,33 @@ class BuilderFooter extends Footer { const BuilderFooter({ required this.builder, - required double triggerOffset, - required bool clamping, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - SpringBuilder? readySpringBuilder, - SpringBuilder? horizontalReadySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool safeArea = true, - double? infiniteOffset = 0, - bool? hitOver, - bool? infiniteHitOver, - IndicatorPosition position = IndicatorPosition.above, - bool hapticFeedback = false, - double? secondaryTriggerOffset, - 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, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - horizontalSpring: horizontalSpring, - readySpringBuilder: readySpringBuilder, - horizontalReadySpringBuilder: horizontalReadySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - notifyWhenInvisible: notifyWhenInvisible, - listenable: listenable, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - triggerWhenReleaseNoWait: triggerWhenReleaseNoWait, - maxOverOffset: maxOverOffset, - ); + required super.triggerOffset, + required super.clamping, + super.processedDuration, + super.spring, + super.horizontalSpring, + super.readySpringBuilder, + super.horizontalReadySpringBuilder, + super.springRebound, + super.frictionFactor, + super.horizontalFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.position, + super.hapticFeedback, + super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.notifyWhenInvisible, + super.listenable, + super.triggerWhenReach, + super.triggerWhenRelease, + super.triggerWhenReleaseNoWait, + super.maxOverOffset, + }); @override Widget build(BuildContext context, IndicatorState state) { @@ -131,58 +77,33 @@ class BuilderFooter extends Footer { /// Listen to the indicator state and respond anywhere. class ListenerFooter extends Footer { const ListenerFooter({ - required IndicatorStateListenable listenable, - required double triggerOffset, - bool clamping = true, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - SpringBuilder? readySpringBuilder, - SpringBuilder? horizontalReadySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool safeArea = true, - double? infiniteOffset = 0, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - double? secondaryTriggerOffset, - double secondaryVelocity = kDefaultSecondaryVelocity, - double? secondaryDimension, - double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset, - bool notifyWhenInvisible = false, - bool triggerWhenReach = false, - bool triggerWhenRelease = false, - bool triggerWhenReleaseNoWait = false, - double maxOverOffset = double.infinity, + required IndicatorStateListenable super.listenable, + required super.triggerOffset, + super.clamping = true, + super.processedDuration, + super.spring, + super.horizontalSpring, + super.readySpringBuilder, + super.horizontalReadySpringBuilder, + super.springRebound, + super.frictionFactor, + super.horizontalFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.notifyWhenInvisible, + super.triggerWhenReach, + super.triggerWhenRelease, + super.triggerWhenReleaseNoWait, + super.maxOverOffset, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - horizontalSpring: horizontalSpring, - readySpringBuilder: readySpringBuilder, - horizontalReadySpringBuilder: horizontalReadySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, position: IndicatorPosition.custom, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - hapticFeedback: hapticFeedback, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - notifyWhenInvisible: notifyWhenInvisible, - listenable: listenable, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - triggerWhenReleaseNoWait: triggerWhenReleaseNoWait, - maxOverOffset: maxOverOffset, ); @override @@ -199,10 +120,10 @@ abstract class SecondaryFooter extends Footer { SecondaryFooter({ required this.footer, - required double secondaryTriggerOffset, - double secondaryVelocity = kDefaultSecondaryVelocity, - double? secondaryDimension, - double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset, + required double super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, IndicatorStateListenable? listenable, }) : super( triggerOffset: footer.triggerOffset, @@ -221,10 +142,6 @@ abstract class SecondaryFooter extends Footer { infiniteHitOver: footer.infiniteHitOver, position: footer.position, hapticFeedback: footer.hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, notifyWhenInvisible: footer.notifyWhenInvisible, listenable: listenable ?? footer.listenable, triggerWhenReach: footer.triggerWhenReach, @@ -248,21 +165,14 @@ class SecondaryBuilderFooter extends SecondaryFooter { final SecondaryIndicatorBuilder builder; SecondaryBuilderFooter({ - required Footer footer, + required super.footer, required this.builder, - required double secondaryTriggerOffset, - double secondaryVelocity = kDefaultSecondaryVelocity, - double? secondaryDimension, - double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset, - IndicatorStateListenable? listenable, - }) : super( - footer: footer, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - listenable: listenable, - ); + required super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.listenable, + }); @override Widget secondaryBuild( @@ -275,26 +185,18 @@ class SecondaryBuilderFooter extends SecondaryFooter { /// Overscroll behavior of [ScrollView]. class NotLoadFooter extends Footer { const NotLoadFooter({ - bool clamping = false, - IndicatorPosition position = IndicatorPosition.custom, - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool? hitOver, - double maxOverOffset = double.infinity, + super.clamping = false, + super.position = IndicatorPosition.custom, + super.spring, + super.horizontalSpring, + super.frictionFactor, + super.horizontalFrictionFactor, + super.hitOver, + super.maxOverOffset, }) : super( triggerOffset: 0, - clamping: clamping, infiniteOffset: null, - position: position, - spring: spring, - horizontalSpring: horizontalSpring, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, processedDuration: const Duration(seconds: 0), - hitOver: hitOver, - maxOverOffset: maxOverOffset, ); @override diff --git a/lib/src/indicator/footer/footer_locator.dart b/lib/src/indicator/footer/footer_locator.dart index 8d838b22..0c3474c6 100644 --- a/lib/src/indicator/footer/footer_locator.dart +++ b/lib/src/indicator/footer/footer_locator.dart @@ -16,19 +16,17 @@ class FooterLocator extends StatelessWidget { /// Use in Box const FooterLocator({ - Key? key, + super.key, this.paintExtent = 0, this.clearExtent = true, - }) : _isSliver = false, - super(key: key); + }) : _isSliver = false; /// User in Sliver const FooterLocator.sliver({ - Key? key, + super.key, this.paintExtent = 0, this.clearExtent = true, - }) : _isSliver = true, - super(key: key); + }) : _isSliver = true; @override Widget build(BuildContext context) { @@ -78,11 +76,11 @@ class _FooterLocatorRenderWidget extends SingleChildRenderObjectWidget { final double paintExtent; const _FooterLocatorRenderWidget({ - Key? key, - required Widget? child, + super.key, + required super.child, required this.isSliver, required this.paintExtent, - }) : super(key: key, child: child); + }); @override RenderObject createRenderObject(BuildContext context) => isSliver @@ -172,8 +170,8 @@ class _FooterLocatorRenderSliver extends RenderSliverSingleBoxAdapter { _FooterLocatorRenderSliver({ required this.context, required this.paintExtent, - RenderBox? child, - }) : super(child: child); + super.child, + }); @override void performLayout() { diff --git a/lib/src/indicator/header/header.dart b/lib/src/indicator/header/header.dart index a884ec8a..a4b78697 100644 --- a/lib/src/indicator/header/header.dart +++ b/lib/src/indicator/header/header.dart @@ -3,60 +3,33 @@ part of '../../../easy_refresh.dart'; /// Header indicator. abstract class Header extends Indicator { const Header({ - required double triggerOffset, - required bool clamping, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - SpringBuilder? readySpringBuilder, - SpringBuilder? horizontalReadySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - IndicatorPosition position = IndicatorPosition.above, - bool hapticFeedback = false, - double? secondaryTriggerOffset, - 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, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - horizontalSpring: horizontalSpring, - readySpringBuilder: readySpringBuilder, - horizontalReadySpringBuilder: horizontalReadySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - notifyWhenInvisible: notifyWhenInvisible, - listenable: listenable, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - triggerWhenReleaseNoWait: triggerWhenReleaseNoWait, - maxOverOffset: maxOverOffset, - ); + required super.triggerOffset, + required super.clamping, + super.processedDuration, + super.spring, + super.horizontalSpring, + super.readySpringBuilder, + super.horizontalReadySpringBuilder, + super.springRebound, + super.frictionFactor, + super.horizontalFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.position, + super.hapticFeedback, + super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.notifyWhenInvisible, + super.listenable, + super.triggerWhenReach, + super.triggerWhenRelease, + super.triggerWhenReleaseNoWait, + super.maxOverOffset, + }); } /// Build header widget use [IndicatorBuilder]. @@ -66,60 +39,33 @@ class BuilderHeader extends Header { const BuilderHeader({ required this.builder, - required double triggerOffset, - required bool clamping, - required IndicatorPosition position, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - SpringBuilder? readySpringBuilder, - SpringBuilder? horizontalReadySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - double? secondaryTriggerOffset, - 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, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - horizontalSpring: horizontalSpring, - readySpringBuilder: readySpringBuilder, - horizontalReadySpringBuilder: horizontalReadySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - notifyWhenInvisible: notifyWhenInvisible, - listenable: listenable, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - triggerWhenReleaseNoWait: triggerWhenReleaseNoWait, - maxOverOffset: maxOverOffset, - ); + required super.triggerOffset, + required super.clamping, + required super.position, + super.processedDuration, + super.spring, + super.horizontalSpring, + super.readySpringBuilder, + super.horizontalReadySpringBuilder, + super.springRebound, + super.frictionFactor, + super.horizontalFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.notifyWhenInvisible, + super.listenable, + super.triggerWhenReach, + super.triggerWhenRelease, + super.triggerWhenReleaseNoWait, + super.maxOverOffset, + }); @override Widget build(BuildContext context, IndicatorState state) { @@ -131,58 +77,33 @@ class BuilderHeader extends Header { /// Listen to the indicator state and respond anywhere. class ListenerHeader extends Header { const ListenerHeader({ - required IndicatorStateListenable listenable, - required double triggerOffset, - bool clamping = true, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - SpringBuilder? readySpringBuilder, - SpringBuilder? horizontalReadySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - double? secondaryTriggerOffset, - double secondaryVelocity = kDefaultSecondaryVelocity, - double? secondaryDimension, - double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset, - bool notifyWhenInvisible = false, - bool triggerWhenReach = false, - bool triggerWhenRelease = false, - bool triggerWhenReleaseNoWait = false, - double maxOverOffset = double.infinity, + required IndicatorStateListenable super.listenable, + required super.triggerOffset, + super.clamping = true, + super.processedDuration, + super.spring, + super.horizontalSpring, + super.readySpringBuilder, + super.horizontalReadySpringBuilder, + super.springRebound, + super.frictionFactor, + super.horizontalFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.notifyWhenInvisible, + super.triggerWhenReach, + super.triggerWhenRelease, + super.triggerWhenReleaseNoWait, + super.maxOverOffset, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - horizontalSpring: horizontalSpring, - readySpringBuilder: readySpringBuilder, - horizontalReadySpringBuilder: horizontalReadySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, position: IndicatorPosition.custom, - hapticFeedback: hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - notifyWhenInvisible: notifyWhenInvisible, - listenable: listenable, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - triggerWhenReleaseNoWait: triggerWhenReleaseNoWait, - maxOverOffset: maxOverOffset, ); @override @@ -199,10 +120,10 @@ abstract class SecondaryHeader extends Header { SecondaryHeader({ required this.header, - required double secondaryTriggerOffset, - double secondaryVelocity = kDefaultSecondaryVelocity, - double? secondaryDimension, - double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset, + required double super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, IndicatorStateListenable? listenable, }) : super( triggerOffset: header.triggerOffset, @@ -221,10 +142,6 @@ abstract class SecondaryHeader extends Header { infiniteHitOver: header.infiniteHitOver, position: header.position, hapticFeedback: header.hapticFeedback, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, notifyWhenInvisible: header.notifyWhenInvisible, listenable: listenable ?? header.listenable, triggerWhenReach: header.triggerWhenReach, @@ -248,21 +165,14 @@ class SecondaryBuilderHeader extends SecondaryHeader { final SecondaryIndicatorBuilder builder; SecondaryBuilderHeader({ - required Header header, + required super.header, required this.builder, - required double secondaryTriggerOffset, - double secondaryVelocity = kDefaultSecondaryVelocity, - double? secondaryDimension, - double secondaryCloseTriggerOffset = kDefaultSecondaryCloseTriggerOffset, - IndicatorStateListenable? listenable, - }) : super( - header: header, - secondaryTriggerOffset: secondaryTriggerOffset, - secondaryVelocity: secondaryVelocity, - secondaryDimension: secondaryDimension, - secondaryCloseTriggerOffset: secondaryCloseTriggerOffset, - listenable: listenable, - ); + required super.secondaryTriggerOffset, + super.secondaryVelocity, + super.secondaryDimension, + super.secondaryCloseTriggerOffset, + super.listenable, + }); @override Widget secondaryBuild( @@ -275,26 +185,18 @@ class SecondaryBuilderHeader extends SecondaryHeader { /// Overscroll behavior of [ScrollView]. class NotRefreshHeader extends Header { const NotRefreshHeader({ - bool clamping = false, - IndicatorPosition position = IndicatorPosition.custom, - physics.SpringDescription? spring, - physics.SpringDescription? horizontalSpring, - FrictionFactor? frictionFactor, - FrictionFactor? horizontalFrictionFactor, - bool? hitOver, - double maxOverOffset = double.infinity, + super.clamping = false, + super.position = IndicatorPosition.custom, + super.spring, + super.horizontalSpring, + super.frictionFactor, + super.horizontalFrictionFactor, + super.hitOver, + super.maxOverOffset, }) : super( triggerOffset: 0, - clamping: clamping, infiniteOffset: null, - position: position, - spring: spring, - horizontalSpring: horizontalSpring, - frictionFactor: frictionFactor, - horizontalFrictionFactor: horizontalFrictionFactor, processedDuration: const Duration(seconds: 0), - hitOver: hitOver, - maxOverOffset: maxOverOffset, ); @override diff --git a/lib/src/indicator/header/header_locator.dart b/lib/src/indicator/header/header_locator.dart index e1e9c273..8c9f9359 100644 --- a/lib/src/indicator/header/header_locator.dart +++ b/lib/src/indicator/header/header_locator.dart @@ -16,19 +16,17 @@ class HeaderLocator extends StatelessWidget { /// Use in Box const HeaderLocator({ - Key? key, + super.key, this.paintExtent = 0, this.clearExtent = true, - }) : _isSliver = false, - super(key: key); + }) : _isSliver = false; /// User in Sliver const HeaderLocator.sliver({ - Key? key, + super.key, this.paintExtent = 0, this.clearExtent = true, - }) : _isSliver = true, - super(key: key); + }) : _isSliver = true; @override Widget build(BuildContext context) { @@ -78,11 +76,11 @@ class _HeaderLocatorRenderWidget extends SingleChildRenderObjectWidget { final double paintExtent; const _HeaderLocatorRenderWidget({ - Key? key, - required Widget? child, + super.key, + required super.child, required this.isSliver, required this.paintExtent, - }) : super(key: key, child: child); + }); @override RenderObject createRenderObject(BuildContext context) => isSliver @@ -172,8 +170,8 @@ class _HeaderLocatorRenderSliver extends RenderSliverSingleBoxAdapter { _HeaderLocatorRenderSliver({ required this.context, required this.paintExtent, - RenderBox? child, - }) : super(child: child); + super.child, + }); @override void performLayout() { diff --git a/lib/src/notifier/indicator_notifier.dart b/lib/src/notifier/indicator_notifier.dart index e6f05900..cec760b2 100644 --- a/lib/src/notifier/indicator_notifier.dart +++ b/lib/src/notifier/indicator_notifier.dart @@ -938,21 +938,17 @@ class _IndicatorListenable class HeaderNotifier extends IndicatorNotifier { HeaderNotifier({ required Header header, - required ValueNotifier userOffsetNotifier, - required TickerProviderStateMixin vsync, + required super.userOffsetNotifier, + required super.vsync, required CanProcessCallBack onCanRefresh, - bool canProcessAfterNoMore = false, + super.canProcessAfterNoMore = false, bool canProcessAfterFail = true, - Axis? triggerAxis, + super.triggerAxis, FutureOr Function()? onRefresh, bool waitRefreshResult = true, }) : super( indicator: header, - userOffsetNotifier: userOffsetNotifier, - vsync: vsync, onCanProcess: onCanRefresh, - canProcessAfterNoMore: canProcessAfterNoMore, - triggerAxis: triggerAxis, task: onRefresh, waitTaskResult: waitRefreshResult, ); @@ -1093,21 +1089,17 @@ class HeaderNotifier extends IndicatorNotifier { class FooterNotifier extends IndicatorNotifier { FooterNotifier({ required Footer footer, - required ValueNotifier userOffsetNotifier, - required TickerProviderStateMixin vsync, + required super.userOffsetNotifier, + required super.vsync, required CanProcessCallBack onCanLoad, - bool canProcessAfterNoMore = false, + super.canProcessAfterNoMore = false, bool canProcessAfterFail = true, - Axis? triggerAxis, + super.triggerAxis, FutureOr Function()? onLoad, bool waitLoadResult = true, }) : super( indicator: footer, - userOffsetNotifier: userOffsetNotifier, - vsync: vsync, onCanProcess: onCanLoad, - canProcessAfterNoMore: canProcessAfterNoMore, - triggerAxis: triggerAxis, task: onLoad, waitTaskResult: waitLoadResult, ); diff --git a/lib/src/painter/paths_painter.dart b/lib/src/painter/paths_painter.dart index e15f44ef..0974d0ae 100644 --- a/lib/src/painter/paths_painter.dart +++ b/lib/src/painter/paths_painter.dart @@ -25,12 +25,12 @@ class PathsPaint extends StatefulWidget { final double? height; const PathsPaint({ - Key? key, + super.key, required this.paths, required this.colors, this.width, this.height, - }) : super(key: key); + }); @override State createState() => _PathsPaintState(); diff --git a/lib/src/physics/scroll_physics.dart b/lib/src/physics/scroll_physics.dart index ba0f2b50..166a89ca 100644 --- a/lib/src/physics/scroll_physics.dart +++ b/lib/src/physics/scroll_physics.dart @@ -9,15 +9,14 @@ typedef FrictionFactor = double Function(double overscrollFraction); /// EasyRefresh scroll physics. class _ERScrollPhysics extends BouncingScrollPhysics { _ERScrollPhysics({ - ScrollPhysics? parent = const AlwaysScrollableScrollPhysics(), + super.parent = const AlwaysScrollableScrollPhysics(), required this.userOffsetNotifier, required this.headerNotifier, required this.footerNotifier, physics.SpringDescription? spring, FrictionFactor? frictionFactor, }) : _spring = spring, - _frictionFactor = frictionFactor, - super(parent: parent) { + _frictionFactor = frictionFactor { headerNotifier._bindPhysics(this); footerNotifier._bindPhysics(this); _headerSimulationCreationState = diff --git a/lib/src/styles/bezier/bezier_background.dart b/lib/src/styles/bezier/bezier_background.dart index f384704c..92505395 100644 --- a/lib/src/styles/bezier/bezier_background.dart +++ b/lib/src/styles/bezier/bezier_background.dart @@ -60,7 +60,7 @@ class BezierBackground extends StatefulWidget { final ValueChanged? onReboundOffsetChanged; const BezierBackground({ - Key? key, + super.key, required this.state, required this.reverse, this.useAnimation = true, @@ -70,7 +70,7 @@ class BezierBackground extends StatefulWidget { this.disappearAnimation = false, this.disappearAnimationDuration = kBezierBackgroundDisappearDuration, this.onReboundOffsetChanged, - }) : super(key: key); + }); @override State createState() => _BezierBackgroundState(); diff --git a/lib/src/styles/bezier/bezier_circle_indicator.dart b/lib/src/styles/bezier/bezier_circle_indicator.dart index fb820471..f1382f6b 100644 --- a/lib/src/styles/bezier/bezier_circle_indicator.dart +++ b/lib/src/styles/bezier/bezier_circle_indicator.dart @@ -19,11 +19,11 @@ class _BezierCircleIndicator extends StatefulWidget { final Color? backgroundColor; const _BezierCircleIndicator({ - Key? key, + super.key, required this.state, this.foregroundColor, this.backgroundColor, - }) : super(key: key); + }); @override State<_BezierCircleIndicator> createState() => _BezierCircleIndicatorState(); diff --git a/lib/src/styles/bezier/bezier_indicator.dart b/lib/src/styles/bezier/bezier_indicator.dart index 1e23cef4..92db5272 100644 --- a/lib/src/styles/bezier/bezier_indicator.dart +++ b/lib/src/styles/bezier/bezier_indicator.dart @@ -45,7 +45,7 @@ class _BezierIndicator extends StatefulWidget { final bool onlySpin; const _BezierIndicator({ - Key? key, + super.key, required this.state, required this.reverse, required this.processedDuration, @@ -57,7 +57,7 @@ class _BezierIndicator extends StatefulWidget { this.spinBuilder, this.foregroundColor, this.backgroundColor, - }) : super(key: key); + }); @override State<_BezierIndicator> createState() => _BezierIndicatorState(); diff --git a/lib/src/styles/bezier/footer/bezier_footer.dart b/lib/src/styles/bezier/footer/bezier_footer.dart index 43e51de3..3cba9621 100644 --- a/lib/src/styles/bezier/footer/bezier_footer.dart +++ b/lib/src/styles/bezier/footer/bezier_footer.dart @@ -31,19 +31,19 @@ class BezierFooter extends Footer { const BezierFooter({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = kBezierBackgroundDisappearDuration, - physics.SpringDescription? spring, - SpringBuilder readySpringBuilder = kBezierSpringBuilder, - bool springRebound = false, - FrictionFactor frictionFactor = kBezierFrictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.processedDuration = kBezierBackgroundDisappearDuration, + super.spring, + SpringBuilder super.readySpringBuilder = kBezierSpringBuilder, + super.springRebound = false, + FrictionFactor super.frictionFactor = kBezierFrictionFactor, + super.safeArea, + super.infiniteOffset = null, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.showBalls = true, this.spinInCenter = true, this.onlySpin = false, @@ -52,21 +52,7 @@ class BezierFooter extends Footer { this.spinBuilder, this.foregroundColor, this.backgroundColor, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - ); + }); @override Widget build(BuildContext context, IndicatorState state) { diff --git a/lib/src/styles/bezier/header/bezier_circle_header.dart b/lib/src/styles/bezier/header/bezier_circle_header.dart index 83623091..807d239e 100644 --- a/lib/src/styles/bezier/header/bezier_circle_header.dart +++ b/lib/src/styles/bezier/header/bezier_circle_header.dart @@ -13,34 +13,22 @@ class BezierCircleHeader extends Header { const BezierCircleHeader({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - physics.SpringDescription? spring, - SpringBuilder readySpringBuilder = kBezierSpringBuilder, - bool springRebound = false, - FrictionFactor frictionFactor = kBezierFrictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.spring, + SpringBuilder super.readySpringBuilder = kBezierSpringBuilder, + super.springRebound = false, + FrictionFactor super.frictionFactor = kBezierFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.foregroundColor, this.backgroundColor, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, processedDuration: kBezierCircleDisappearDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, ); @override diff --git a/lib/src/styles/bezier/header/bezier_header.dart b/lib/src/styles/bezier/header/bezier_header.dart index 84d82520..a3874df9 100644 --- a/lib/src/styles/bezier/header/bezier_header.dart +++ b/lib/src/styles/bezier/header/bezier_header.dart @@ -31,19 +31,19 @@ class BezierHeader extends Header { const BezierHeader({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = kBezierBackgroundDisappearDuration, - physics.SpringDescription? spring, - SpringBuilder readySpringBuilder = kBezierSpringBuilder, - bool springRebound = false, - FrictionFactor frictionFactor = kBezierFrictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.processedDuration = kBezierBackgroundDisappearDuration, + super.spring, + SpringBuilder super.readySpringBuilder = kBezierSpringBuilder, + super.springRebound = false, + FrictionFactor super.frictionFactor = kBezierFrictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.showBalls = true, this.spinInCenter = true, this.onlySpin = false, @@ -52,21 +52,7 @@ class BezierHeader extends Header { this.spinBuilder, this.foregroundColor, this.backgroundColor, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - ); + }); @override Widget build(BuildContext context, IndicatorState state) { diff --git a/lib/src/styles/bezier/spin/hour_glass.dart b/lib/src/styles/bezier/spin/hour_glass.dart index 54187ba2..86b656ab 100644 --- a/lib/src/styles/bezier/spin/hour_glass.dart +++ b/lib/src/styles/bezier/spin/hour_glass.dart @@ -4,10 +4,10 @@ part of '../../../../easy_refresh.dart'; /// flutter_spinkit LICENSE [https://github.com/jogboms/flutter_spinkit/blob/master/LICENSE]. class _SpinKitHourGlass extends StatefulWidget { const _SpinKitHourGlass({ - Key? key, + super.key, required this.color, this.size = 50.0, - }) : super(key: key); + }); final Color color; final double size; diff --git a/lib/src/styles/classic/classic_indicator.dart b/lib/src/styles/classic/classic_indicator.dart index 9f7a65dc..c02177d2 100644 --- a/lib/src/styles/classic/classic_indicator.dart +++ b/lib/src/styles/classic/classic_indicator.dart @@ -115,7 +115,7 @@ class _ClassicIndicator extends StatefulWidget { final double? progressIndicatorStrokeWidth; const _ClassicIndicator({ - Key? key, + super.key, required this.state, required this.mainAxisAlignment, this.backgroundColor, @@ -149,8 +149,7 @@ class _ClassicIndicator extends StatefulWidget { mainAxisAlignment == MainAxisAlignment.start || mainAxisAlignment == MainAxisAlignment.center || mainAxisAlignment == MainAxisAlignment.end, - 'Only supports [MainAxisAlignment.center], [MainAxisAlignment.start] and [MainAxisAlignment.end].'), - super(key: key); + 'Only supports [MainAxisAlignment.center], [MainAxisAlignment.start] and [MainAxisAlignment.end].'); @override State<_ClassicIndicator> createState() => _ClassicIndicatorState(); diff --git a/lib/src/styles/classic/footer/classic_footer.dart b/lib/src/styles/classic/footer/classic_footer.dart index 5e4b2604..10005155 100644 --- a/lib/src/styles/classic/footer/classic_footer.dart +++ b/lib/src/styles/classic/footer/classic_footer.dart @@ -92,22 +92,22 @@ class ClassicFooter extends Footer { const ClassicFooter({ this.key, - double triggerOffset = 70, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = Duration.zero, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = true, - FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset = 70, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - bool triggerWhenReach = false, - bool triggerWhenRelease = false, - double maxOverOffset = double.infinity, + super.triggerOffset = 70, + super.clamping = false, + super.position, + super.processedDuration = Duration.zero, + super.spring, + super.readySpringBuilder, + super.springRebound, + super.frictionFactor, + super.safeArea, + super.infiniteOffset = 70, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.triggerWhenReach, + super.triggerWhenRelease, + super.maxOverOffset, this.mainAxisAlignment = MainAxisAlignment.start, this.backgroundColor, this.dragText, @@ -135,24 +135,7 @@ class ClassicFooter extends Footer { this.iconTheme, this.progressIndicatorSize, this.progressIndicatorStrokeWidth, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - triggerWhenReach: triggerWhenReach, - triggerWhenRelease: triggerWhenRelease, - maxOverOffset: maxOverOffset, - ); + }); @override Widget build(BuildContext context, IndicatorState state) { diff --git a/lib/src/styles/classic/header/classic_header.dart b/lib/src/styles/classic/header/classic_header.dart index bb14e02b..6c047c9d 100644 --- a/lib/src/styles/classic/header/classic_header.dart +++ b/lib/src/styles/classic/header/classic_header.dart @@ -1,4 +1,4 @@ -part of easy_refresh; +part of '../../../../easy_refresh.dart'; /// Classic header. class ClassicHeader extends Header { diff --git a/lib/src/styles/cupertino/cupertino_activity_indicator.dart b/lib/src/styles/cupertino/cupertino_activity_indicator.dart index 86f01a4f..15c76c94 100644 --- a/lib/src/styles/cupertino/cupertino_activity_indicator.dart +++ b/lib/src/styles/cupertino/cupertino_activity_indicator.dart @@ -24,13 +24,12 @@ const Color _kActiveTickColor = CupertinoDynamicColor.withBrightness( class _CupertinoActivityIndicator extends StatefulWidget { /// Creates an iOS-style activity indicator that spins clockwise. const _CupertinoActivityIndicator({ - Key? key, + super.key, this.color, this.animating = true, this.radius = _kDefaultIndicatorRadius, }) : assert(radius > 0.0), - progress = 1.0, - super(key: key); + progress = 1.0; /// Creates a non-animated iOS-style activity indicator that displays /// a partial count of ticks based on the value of [progress]. @@ -39,15 +38,14 @@ class _CupertinoActivityIndicator extends StatefulWidget { /// will be shown) and 1.0 (all ticks will be shown) inclusive. Defaults /// to 1.0. const _CupertinoActivityIndicator.partiallyRevealed({ - Key? key, + super.key, this.color, this.radius = _kDefaultIndicatorRadius, this.progress = 1.0, }) : assert(radius > 0.0), assert(progress >= 0.0), assert(progress <= 1.0), - animating = false, - super(key: key); + animating = false; /// Color of the activity indicator. /// diff --git a/lib/src/styles/cupertino/cupertino_indicator.dart b/lib/src/styles/cupertino/cupertino_indicator.dart index 93cd50dc..695f3840 100644 --- a/lib/src/styles/cupertino/cupertino_indicator.dart +++ b/lib/src/styles/cupertino/cupertino_indicator.dart @@ -36,14 +36,14 @@ class _CupertinoIndicator extends StatefulWidget { final Widget? emptyWidget; const _CupertinoIndicator({ - Key? key, + super.key, required this.state, required this.reverse, this.foregroundColor, this.userWaterDrop = true, this.backgroundColor, this.emptyWidget, - }) : super(key: key); + }); @override State<_CupertinoIndicator> createState() => _CupertinoIndicatorState(); diff --git a/lib/src/styles/cupertino/footer/cupertino_footer.dart b/lib/src/styles/cupertino/footer/cupertino_footer.dart index c2807d79..16d2634e 100644 --- a/lib/src/styles/cupertino/footer/cupertino_footer.dart +++ b/lib/src/styles/cupertino/footer/cupertino_footer.dart @@ -20,45 +20,31 @@ class CupertinoFooter extends Footer { const CupertinoFooter({ this.key, - double triggerOffset = 60, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.behind, - Duration processedDuration = Duration.zero, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = true, + super.triggerOffset = 60, + super.clamping = false, + super.position = IndicatorPosition.behind, + super.processedDuration = Duration.zero, + super.spring, + super.readySpringBuilder, + super.springRebound, FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset = 60, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - bool triggerWhenRelease = false, - double maxOverOffset = double.infinity, + super.safeArea, + super.infiniteOffset = 60, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.triggerWhenRelease, + super.maxOverOffset, this.foregroundColor, this.userWaterDrop = false, this.backgroundColor, this.emptyWidget, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, frictionFactor: frictionFactor ?? (userWaterDrop && infiniteOffset == null ? kCupertinoFrictionFactor : null), horizontalFrictionFactor: kCupertinoHorizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - triggerWhenRelease: triggerWhenRelease, - maxOverOffset: maxOverOffset, ); @override diff --git a/lib/src/styles/cupertino/header/cupertino_header.dart b/lib/src/styles/cupertino/header/cupertino_header.dart index bdca8e56..84f2d605 100644 --- a/lib/src/styles/cupertino/header/cupertino_header.dart +++ b/lib/src/styles/cupertino/header/cupertino_header.dart @@ -20,45 +20,31 @@ class CupertinoHeader extends Header { const CupertinoHeader({ this.key, - double triggerOffset = 60, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.behind, - Duration processedDuration = Duration.zero, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, + super.triggerOffset = 60, + super.clamping = false, + super.position = IndicatorPosition.behind, + super.processedDuration = Duration.zero, + super.spring, + super.readySpringBuilder, + super.springRebound = false, FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - bool triggerWhenRelease = false, - double maxOverOffset = double.infinity, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.triggerWhenRelease, + super.maxOverOffset, this.foregroundColor, this.userWaterDrop = true, this.backgroundColor, this.emptyWidget, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, frictionFactor: frictionFactor ?? (userWaterDrop && infiniteOffset == null ? kCupertinoFrictionFactor : null), horizontalFrictionFactor: kCupertinoHorizontalFrictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - triggerWhenRelease: triggerWhenRelease, - maxOverOffset: maxOverOffset, ); @override diff --git a/lib/src/styles/delivery/delivery_indicator.dart b/lib/src/styles/delivery/delivery_indicator.dart index 1d1b8353..45eff8b7 100644 --- a/lib/src/styles/delivery/delivery_indicator.dart +++ b/lib/src/styles/delivery/delivery_indicator.dart @@ -22,11 +22,11 @@ class _DeliveryIndicator extends StatefulWidget { final Color? skyColor; const _DeliveryIndicator({ - Key? key, + super.key, required this.state, required this.reverse, this.skyColor, - }) : super(key: key); + }); @override State<_DeliveryIndicator> createState() => _DeliveryIndicatorState(); diff --git a/lib/src/styles/delivery/footer/delivery_footer.dart b/lib/src/styles/delivery/footer/delivery_footer.dart index 12864237..396a15cc 100644 --- a/lib/src/styles/delivery/footer/delivery_footer.dart +++ b/lib/src/styles/delivery/footer/delivery_footer.dart @@ -10,32 +10,21 @@ class DeliveryFooter extends Footer { const DeliveryFooter({ this.key, - double triggerOffset = kDeliveryTriggerOffset, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, - FrictionFactor? frictionFactor, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = kDeliveryTriggerOffset, + super.clamping = false, + super.position, + super.spring, + super.readySpringBuilder, + super.springRebound = false, + super.frictionFactor, + super.infiniteOffset = null, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.skyColor, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, processedDuration: const Duration(milliseconds: 100), - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, safeArea: false, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, ); @override diff --git a/lib/src/styles/delivery/header/delivery_header.dart b/lib/src/styles/delivery/header/delivery_header.dart index 9a068dec..a35db26e 100644 --- a/lib/src/styles/delivery/header/delivery_header.dart +++ b/lib/src/styles/delivery/header/delivery_header.dart @@ -10,32 +10,21 @@ class DeliveryHeader extends Header { const DeliveryHeader({ this.key, - double triggerOffset = kDeliveryTriggerOffset, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, - FrictionFactor? frictionFactor, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = kDeliveryTriggerOffset, + super.clamping = false, + super.position, + super.spring, + super.readySpringBuilder, + super.springRebound = false, + super.frictionFactor, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.skyColor, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, processedDuration: const Duration(milliseconds: 100), - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, safeArea: false, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, ); @override diff --git a/lib/src/styles/material/footer/material_footer.dart b/lib/src/styles/material/footer/material_footer.dart index 1544a845..fc836f6d 100644 --- a/lib/src/styles/material/footer/material_footer.dart +++ b/lib/src/styles/material/footer/material_footer.dart @@ -39,21 +39,21 @@ class MaterialFooter extends Footer { const MaterialFooter({ this.key, - double triggerOffset = 100, - bool clamping = true, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = const Duration(milliseconds: 200), - physics.SpringDescription? spring, + super.triggerOffset = 100, + super.clamping = true, + super.position, + super.processedDuration = const Duration(milliseconds: 200), + super.spring, SpringBuilder? readySpringBuilder, - bool springRebound = false, + super.springRebound = false, FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - bool triggerWhenRelease = false, - double maxOverOffset = double.infinity, + super.safeArea, + super.infiniteOffset = null, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.triggerWhenRelease, + super.maxOverOffset, this.backgroundColor, this.color, this.valueColor, @@ -65,15 +65,10 @@ class MaterialFooter extends Footer { this.bezierBackgroundAnimation = false, this.bezierBackgroundBounce = false, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, readySpringBuilder: readySpringBuilder ?? (bezierBackgroundAnimation ? kBezierSpringBuilder : kMaterialSpringBuilder), - springRebound: springRebound, frictionFactor: frictionFactor ?? (showBezierBackground ? kBezierFrictionFactor @@ -82,14 +77,6 @@ class MaterialFooter extends Footer { (showBezierBackground ? kBezierHorizontalFrictionFactor : kMaterialHorizontalFrictionFactor), - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - triggerWhenRelease: triggerWhenRelease, - maxOverOffset: maxOverOffset, ); @override diff --git a/lib/src/styles/material/header/material_header.dart b/lib/src/styles/material/header/material_header.dart index d95c24c8..df872790 100644 --- a/lib/src/styles/material/header/material_header.dart +++ b/lib/src/styles/material/header/material_header.dart @@ -39,21 +39,21 @@ class MaterialHeader extends Header { const MaterialHeader({ this.key, - double triggerOffset = 100, - bool clamping = true, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = const Duration(milliseconds: 200), - physics.SpringDescription? spring, - bool springRebound = false, + super.triggerOffset = 100, + super.clamping = true, + super.position, + super.processedDuration = const Duration(milliseconds: 200), + super.spring, + super.springRebound = false, SpringBuilder? readySpringBuilder, FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, - bool triggerWhenRelease = false, - double maxOverOffset = double.infinity, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, + super.triggerWhenRelease, + super.maxOverOffset, this.backgroundColor, this.color, this.valueColor, @@ -65,15 +65,10 @@ class MaterialHeader extends Header { this.bezierBackgroundAnimation = false, this.bezierBackgroundBounce = false, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, readySpringBuilder: readySpringBuilder ?? (bezierBackgroundAnimation ? kBezierSpringBuilder : kMaterialSpringBuilder), - springRebound: springRebound, frictionFactor: frictionFactor ?? (showBezierBackground ? kBezierFrictionFactor @@ -82,14 +77,6 @@ class MaterialHeader extends Header { (showBezierBackground ? kBezierHorizontalFrictionFactor : kMaterialHorizontalFrictionFactor), - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - triggerWhenRelease: triggerWhenRelease, - maxOverOffset: maxOverOffset, ); @override diff --git a/lib/src/styles/material/material_indicator.dart b/lib/src/styles/material/material_indicator.dart index cc93e677..6e6868aa 100644 --- a/lib/src/styles/material/material_indicator.dart +++ b/lib/src/styles/material/material_indicator.dart @@ -72,7 +72,7 @@ class _MaterialIndicator extends StatefulWidget { final bool bezierBackgroundBounce; const _MaterialIndicator({ - Key? key, + super.key, required this.state, required this.disappearDuration, required this.reverse, @@ -86,7 +86,7 @@ class _MaterialIndicator extends StatefulWidget { this.bezierBackgroundColor, this.bezierBackgroundAnimation = false, this.bezierBackgroundBounce = false, - }) : super(key: key); + }); @override State<_MaterialIndicator> createState() => _MaterialIndicatorState(); diff --git a/lib/src/styles/phoenix/footer/phoenix_footer.dart b/lib/src/styles/phoenix/footer/phoenix_footer.dart index 5b84a090..543e0ab4 100644 --- a/lib/src/styles/phoenix/footer/phoenix_footer.dart +++ b/lib/src/styles/phoenix/footer/phoenix_footer.dart @@ -10,35 +10,21 @@ class PhoenixFooter extends Footer { const PhoenixFooter({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, - FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.processedDuration, + super.spring, + super.readySpringBuilder, + super.springRebound = false, + super.frictionFactor, + super.safeArea, + super.infiniteOffset = null, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.skyColor, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - ); + }); @override Widget build(BuildContext context, IndicatorState state) { diff --git a/lib/src/styles/phoenix/header/phoenix_header.dart b/lib/src/styles/phoenix/header/phoenix_header.dart index 07de7ae9..0260feb8 100644 --- a/lib/src/styles/phoenix/header/phoenix_header.dart +++ b/lib/src/styles/phoenix/header/phoenix_header.dart @@ -10,35 +10,21 @@ class PhoenixHeader extends Header { const PhoenixHeader({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - Duration processedDuration = const Duration(seconds: 1), - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, - FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.processedDuration, + super.spring, + super.readySpringBuilder, + super.springRebound = false, + super.frictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.skyColor, - }) : super( - triggerOffset: triggerOffset, - clamping: clamping, - processedDuration: processedDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, - ); + }); @override Widget build(BuildContext context, IndicatorState state) { diff --git a/lib/src/styles/phoenix/phoenix_indicator.dart b/lib/src/styles/phoenix/phoenix_indicator.dart index 9a6f00dc..bb4ff4cf 100644 --- a/lib/src/styles/phoenix/phoenix_indicator.dart +++ b/lib/src/styles/phoenix/phoenix_indicator.dart @@ -16,11 +16,11 @@ class _PhoenixIndicator extends StatefulWidget { final Color? skyColor; const _PhoenixIndicator({ - Key? key, + super.key, required this.state, required this.reverse, required this.skyColor, - }) : super(key: key); + }); @override State<_PhoenixIndicator> createState() => _PhoenixIndicatorState(); diff --git a/lib/src/styles/taurus/footer/taurus_footer.dart b/lib/src/styles/taurus/footer/taurus_footer.dart index e5b15416..8c357a36 100644 --- a/lib/src/styles/taurus/footer/taurus_footer.dart +++ b/lib/src/styles/taurus/footer/taurus_footer.dart @@ -10,33 +10,21 @@ class TaurusFooter extends Footer { const TaurusFooter({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, - FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.spring, + super.readySpringBuilder, + super.springRebound = false, + super.frictionFactor, + super.safeArea, + super.infiniteOffset = null, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.skyColor, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, processedDuration: kTaurusDisappearDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, ); @override diff --git a/lib/src/styles/taurus/header/taurus_header.dart b/lib/src/styles/taurus/header/taurus_header.dart index 596801c2..63f193a8 100644 --- a/lib/src/styles/taurus/header/taurus_header.dart +++ b/lib/src/styles/taurus/header/taurus_header.dart @@ -10,33 +10,21 @@ class TaurusHeader extends Header { const TaurusHeader({ this.key, - double triggerOffset = 100, - bool clamping = false, - IndicatorPosition position = IndicatorPosition.above, - physics.SpringDescription? spring, - SpringBuilder? readySpringBuilder, - bool springRebound = false, - FrictionFactor? frictionFactor, - bool safeArea = true, - double? infiniteOffset, - bool? hitOver, - bool? infiniteHitOver, - bool hapticFeedback = false, + super.triggerOffset = 100, + super.clamping = false, + super.position, + super.spring, + super.readySpringBuilder, + super.springRebound = false, + super.frictionFactor, + super.safeArea, + super.infiniteOffset, + super.hitOver, + super.infiniteHitOver, + super.hapticFeedback, this.skyColor, }) : super( - triggerOffset: triggerOffset, - clamping: clamping, processedDuration: kTaurusDisappearDuration, - spring: spring, - readySpringBuilder: readySpringBuilder, - springRebound: springRebound, - frictionFactor: frictionFactor, - safeArea: safeArea, - infiniteOffset: infiniteOffset, - hitOver: hitOver, - infiniteHitOver: infiniteHitOver, - position: position, - hapticFeedback: hapticFeedback, ); @override diff --git a/lib/src/styles/taurus/taurus_indicator.dart b/lib/src/styles/taurus/taurus_indicator.dart index 96b5acc9..5bf2328c 100644 --- a/lib/src/styles/taurus/taurus_indicator.dart +++ b/lib/src/styles/taurus/taurus_indicator.dart @@ -19,11 +19,11 @@ class _TaurusIndicator extends StatefulWidget { final Color? skyColor; const _TaurusIndicator({ - Key? key, + super.key, required this.state, required this.reverse, this.skyColor, - }) : super(key: key); + }); @override State<_TaurusIndicator> createState() => _TaurusIndicatorState();