new_loading_indicator 4.0.0
new_loading_indicator: ^4.0.0 copied to clipboard
A fork of the loading_indicator package, providing a rich collection of loading animations for Flutter applications.
4.0.0 #
Brings the package up to date with upstream loading_indicator 4.0.2. See "Migrating from 3.x" in the README.
Breaking changes
LoadingIndicator.pauseis removed. Pass aLoadingIndicatorControllerto the newLoadingIndicator.controllerand callpause()andresume()on it instead.- When
strokeWidthis set, the five line indicators (lineScale,lineScaleParty,lineScalePulseOut,lineScalePulseOutRapidandlineSpinFadeLoader) draw their bars at that width, centred in the space they used to fill. WithoutstrokeWidththey look as before. Indicator.circleStrokeSpinno longer wrapsCircularProgressIndicator. It draws a three-quarter ring that turns once every 1200 ms, honoursstrokeWidthandpathBackgroundColor, and no longer needs apackage:material_uitheme.
New
LoadingIndicatorController, aChangeNotifierthat controls one indicator:pause()freezes it on the current frame andresume()carries on from there.pauseAt(progress)pauses at a point in the animation cycle, either by playing on to it (LoadingIndicatorPauseBehavior.waitUntilTarget, the default) or by jumping there at once (jumpToTarget). The returned future completes once the indicator has paused, or fails withLoadingIndicatorCommandCanceledif another command replaces it first.status(LoadingIndicatorPlaybackStatus),progressandisAttachedreport its state, and listeners are notified whenever they change.- Commands given before the indicator is built are applied when it is, and the latest command is applied again to each new indicator the controller is given.
- All 34 indicators, including
circleStrokeSpin, can be paused, resumed and moved to any point. Indicators made of several animations keep their relative timing, and reversing animations keep their direction.
Improvements over upstream 4.0.2
- Adding or removing an indicator no longer notifies listeners in the middle of a build. Upstream throws "setState() or markNeedsBuild() called during build" when a
ListenableBuilderoutside the indicator listens to its controller and the indicator is added or removed. pauseAt(..., behavior: waitUntilTarget)stops every animation exactly on the target frame, instead of letting them overshoot and snapping them back. Resuming or re-targeting during the wait does not restart the animations, so they do not hitch.- A canceled
pauseAtfuture that nothing listens to is not reported as an unhandled error. - An indicator moved with a
GlobalKeyfrom under a controller to a place without one starts playing on its own, instead of staying paused. - A line bar whose height animates below its configured width keeps that width. Upstream widens it to fill its whole slot for as long as it is that short.
Internal
- The
IndicatorControllermixin moved tolib/src/control/loading_indicator_controller.dartand now starts every indicator's animation controllers. Indicators declare reversing animations withrepeatsInReverseinstead of callingrepeat()themselves. - Tests: 369 to 434, line coverage stays at 100%. Upstream's controller tests are ported, plus tests for each improvement above.
- The example shows the controller's status and progress and demonstrates pausing,
pauseAtand stroke widths.
3.0.0 #
Breaking changes
- Requires Dart 3.13.5 and Flutter 3.47.6 or newer.
- The package uses
package:material_uiinstead ofpackage:flutter/material.dart. Host apps must provide aThemefrompackage:material_ui(typically by using that package'sMaterialApp). A legacyMaterialAppfrompackage:flutter/material.dartdoes not satisfy the colour fallback. Indicator.circleStrokeSpinwrapsCircularProgressIndicatorfrompackage:material_ui, which also requires that theme.
2.0.0 #
Breaking changes
- Requires Dart 3.13.3 and Flutter 3.47.3 or newer.
- When
colorsis null or empty, the indicator now falls back toColorScheme.primaryinstead ofThemeData.primaryColor. In a Material 3 dark theme the old value resolved togrey[900]and was hard to see. Indicator.ballPulseSyncnow assigns colour indices 0, 1, 2 to its three balls (previously 0, 2, 4), matching every other indicator.- The
debugPrintwarning emitted on each build whenpause: truewas combined withIndicator.circleStrokeSpinis gone. The limitation is documented onLoadingIndicator.pauseinstead.
Fixes
- A pause change that happened while an indicator element was deactivated (for example during
GlobalKeyreparenting) was never applied to its animation controllers. DecorateData.hashCodedid not agree with its==for equal colour lists that were distinct objects.BallRotateChasecalledrepeat()once per ball on its single controller.
Internal
- Removed the unused
asyncandcollectiondependencies. - All indicator widgets are
final class; controllers and animations arelate final; enum arguments use dot shorthands. - Placeholder
List.filled(n, Container())lists replaced with collectionfor;SpacerandRow.spacingreplace hand-built spacers. - Tests: 169 to 368, line coverage 97.3% to 100%. The public
LoadingIndicatoris now exercised for everyIndicatorvalue (build, animate, pause/resume, dispose), everyShapeis checked against real canvas calls, and the controller lifecycle is covered. - Enabled
prefer_final_locals,prefer_final_in_for_each,unnecessary_lambdas,avoid_redundant_argument_valuesandprefer_single_quotes. - CI installs the pinned Flutter release from the official tarball (checksum verified) and runs
dart formatandflutter analyze --fatal-infosbefore tests.
1.2.2 #
- Update dependencies and Dart/Flutter SDK constraints.
1.2.1 #
Update Dart and Flutter SDK version constraints. Fix failing tests. Replace GitHub repository URL with GitLab.
1.1.0 #
Update version numbers, dependencies, and analysis options. Adjusted code formatting for consistency and improved animation handling in various indicators.
1.0.2 #
- Bump Dart and Flutter SDK constraints.
- Change the repository URL.
1.0.1 #
- Created an example application to showcase the loading indicator animations.
- Added the link to the example application running on GitLab Pages to README.md.
1.0.0 #
- Initial release of the
new_loading_indicatorpackage. - Added 169 tests with 97.3% coverage ensuring reliability.
- Added comprehensive documentation for all animations and usage scenarios.