Skip to content

chore: 🚧 Provide support for rive ^0.14.5 #76

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/support-rive-pre-release
Closed

chore: 🚧 Provide support for rive ^0.14.5 #76
Copilot wants to merge 1 commit intomasterfrom
copilot/support-rive-pre-release

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 2, 2025

Description

Updates Splash Master to support Rive 0.14.x, which uses an entirely new C++ runtime-based API replacing the previous Dart implementation.

This is released as version 0.0.4-dev.1 (pre-release).

API Changes

  • RiveConfig: Replaced artboardName/animations/stateMachineName with artboardSelector/stateMachineSelector. Changed fit from BoxFit to Rive's Fit enum. Added riveFactory parameter (nullable, defaults to Factory.rive at runtime). Added dataBind (DataBind?) for view model data binding. Added controller (Controller?) for advanced custom controller creation. Updated splashDuration doc to reflect fixed fallback behavior (no automatic animation-length calculation).
  • RiveSplash: Now uses RiveWidgetBuilder + RiveWidget instead of removed RiveAnimation widget. Added didUpdateWidget to re-initialize FileLoader when source or riveFactory changes. Unsupported source types now always call onSplashDuration (via addPostFrameCallback) to prevent the app from getting stuck on the splash screen.
  • Source types: Added RiveFileSource for pre-loaded files. Removed RiveArtboardSource (not functional with Rive 0.14.x).

Unsupported in Rive 0.14.x

  • DeviceFileSource and BytesSource are no longer supported for Rive splash (use AssetSource, NetworkFileSource, or RiveFileSource)

SDK Requirements

The SDK constraints (Flutter >=3.27.0 and Dart SDK >=3.6.0) are required by Rive 0.14.x itself and cannot be lowered.

Documentation Updates

  • Updated riveConfig description in doc/documentation.md to reference the selector-based API (artboardSelector/stateMachineSelector) instead of the removed animations list API.
  • Updated splashDuration description to accurately state: "If provided, uses this value; otherwise defaults to 3 seconds" (no automatic calculation).

Example

SplashMaster.rive(
  source: AssetSource('assets/animation.riv'),
  riveConfig: RiveConfig(
    artboardSelector: ArtboardSelector.byName('MyArtboard'),
    stateMachineSelector: StateMachineSelector.byDefault(),
    fit: Fit.contain,
    // riveFactory is optional - defaults to Factory.rive
    dataBind: DataBind.auto(), // optional: bind to a view model instance
    // controller: (file) => MyCustomController(file), // optional: custom controller
  ),
  nextScreen: HomeScreen(),
)

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

Migration instructions

  • Update to Flutter >=3.27.0 and Dart SDK >=3.6.0 (required by Rive 0.14.x)

  • Update rive dependency to ^0.14.5

  • Replace RiveArtboardSource with RiveFileSource (the old class has been completely removed)

  • Update RiveConfig to use new selector-based API (artboardSelector/stateMachineSelector)

  • Migrate DeviceFileSource/BytesSource Rive sources to AssetSource or NetworkFileSource

  • Note: riveFactory parameter is now optional and nullable (defaults to Factory.rive)

  • Note: splashDuration now falls back to a fixed 3-second default; there is no automatic animation-length calculation

  • Note: New optional dataBind and controller parameters available in RiveConfig for data binding and custom controller creation

  • Yes, this PR is a breaking change.

  • No, this PR is not a breaking change.

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Support Rive Pre-Release Versions in Splash Master</issue_title>
<issue_description>## Summary

The upcoming pre-release versions of Rive introduce multiple breaking changes that are not compatible with the current release of Splash Master. As a result, developers using the latest Rive pre-release builds are unable to integrate them with Splash Master without encountering errors.

Request

Please provide a new version of Splash Master that is compatible with the latest pre-release versions of Rive. Which aligns with the updated Rive APIs.

Additional context

Link to pre-release of rive-: https://pub.dev/packages/rive/versions/0.14.0-dev.14</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for Rive pre-release versions in Splash Master feat!: Support Rive Pre-Release Versions (0.14.x) Dec 2, 2025
Comment thread pubspec.yaml
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if possible dont update sdk and flutter version. and create a pre-release for it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to pre-release version 0.0.4-dev.1 in commit 5593c48.

Note: The SDK constraints (Flutter >=3.27.0 and Dart SDK >=3.6.0) are required by Rive 0.14.0-dev.14 itself and cannot be lowered. These are hard requirements from the Rive package's own pubspec.yaml.

Comment thread lib/splashes/rive/rive_config.dart Outdated
this.layoutScaleFactor = 1.0,
this.placeHolder,
this.splashDuration,
this.riveFactory = Factory.rive,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factory.rive is not constant so providing it as default param will not work

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit d0226c3. Changed riveFactory to be nullable (Factory?) so the const constructor works. The default value Factory.rive is now applied at runtime when null.

@ujas-m-simformsolutions
Copy link
Copy Markdown
Collaborator

@copilot instead of adding deprecated member just remove them

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot instead of adding deprecated member just remove them

Removed RiveArtboardSource class completely in commit 7574b99. Since this is a breaking change pre-release and the class doesn't work with Rive 0.14.x, it's been fully removed rather than deprecated.

@ujas-m-simformsolutions ujas-m-simformsolutions force-pushed the copilot/support-rive-pre-release branch from 7574b99 to 0fb226e Compare December 3, 2025 08:20
@ujas-m-simformsolutions ujas-m-simformsolutions changed the title feat!: Support Rive Pre-Release Versions (0.14.x) chore: 🚧 Provide support for rive pre-release Dec 3, 2025
@ujas-m-simformsolutions ujas-m-simformsolutions force-pushed the copilot/support-rive-pre-release branch from 0fb226e to 866b279 Compare December 3, 2025 08:26
@ujas-m-simformsolutions ujas-m-simformsolutions marked this pull request as ready for review December 3, 2025 08:27
Comment thread doc/documentation.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Wording on line 228 says riveConfig controls animations to play, but the old animations list API was removed in this PR. Please update phrasing to selector-based API (artboardSelector/stateMachineSelector).
  2. Docs currently state splashDuration overrides automatic calculation based on animation length. That does not match current implementation (fixed fallback). Please update this line to prevent migration confusion

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit e568f92:

  1. Updated the riveConfig row to reference artboardSelector/stateMachineSelector instead of "animations to play".
  2. Updated the splashDuration description to: "Optional explicit duration for the splash screen. If provided, uses this value; otherwise defaults to 3 seconds."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flow depends entirely on _updateSplashDuration being called. In the unsupported-source path in RiveSplash, that callback is never invoked, so onSourceLoaded/resume never runs. Please ensure RiveSplash always reports a duration even on unsupported/failure placeholder states.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit e568f92. The unsupported-source path now calls onSplashDuration via addPostFrameCallback, ensuring the splash flow always completes.


FileLoader? _fileLoader;

@override
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileLoader is initialized only in initState and not updated when source/riveConfig changes. Can we handle widget updates (for example via didUpdateWidget) to avoid stale loader/factory when parent rebuilds with new input?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit e568f92. Added didUpdateWidget that disposes the old FileLoader and re-initializes it when source or riveFactory changes.

@@ -103,30 +78,26 @@ class RiveConfig {
/// If provided, this overrides the automatic duration calculation.
final Duration? splashDuration;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional duration for the splash. If provided, uses this value; otherwise attempts to calculate from animation length, defaulting to 3 seconds if unavailable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in commit e568f92. The doc comment now reads: "Duration for which the splash will be visible for Rive animations. If provided, uses this value; otherwise defaults to 3 seconds."

_fileLoader?.dispose();
super.dispose();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration is now always splashDuration or fixed defaultDuration. There is no automatic animation-duration calculation anymore, but docs/config comments still mention automatic calculation. Please update docs/comments to match behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit e568f92. Updated both the code comment in _onLoaded and the splashDuration doc in rive_config.dart to accurately reflect that the duration is always splashDuration ?? defaultDuration (3 seconds) with no automatic calculation.

widget.onSplashDuration?.call(
riveConfig.splashDuration ?? defaultDuration,
);
Widget _buildRiveWidget() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For unsupported source types, this branch only renders a placeholder and never calls onSplashDuration. Since resume/navigation is triggered through that callback, this can leave the app stuck on splash. Please trigger onSplashDuration here as well (for example with splashDuration or defaultDuration) so flow always continues.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit e568f92. The unsupported-source branch now calls widget.onSplashDuration?.call(riveConfig.splashDuration ?? defaultDuration) via addPostFrameCallback before rendering the placeholder, ensuring navigation/resume always proceeds.

@lavigarg-simform
Copy link
Copy Markdown
Contributor

@copilot please address all the comments added

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

@copilot please address all the comments added

All comments addressed in commit e568f92:

  • Added didUpdateWidget to re-init FileLoader when source or factory changes
  • Unsupported source types now call onSplashDuration to prevent stuck splash
  • Updated splashDuration doc comment in rive_config.dart to reflect fixed fallback (no automatic calculation)
  • Updated documentation.md to use selector-based API wording for riveConfig and accurate splashDuration description

Copilot AI changed the title chore: 🚧 Provide support for rive pre-release chore: 🚧 Provide support for rive pre-release Apr 2, 2026
Copilot AI requested a review from lavigarg-simform April 2, 2026 09:42
@ujas-m-simformsolutions
Copy link
Copy Markdown
Collaborator

@copilot add this two configs in riveConfig and use them

/// The data bind to specify which view model instance to bind to.
  final DataBind? dataBind;

  /// An optional function to manually create the controller instead of using
  /// the default one.
  final Controller? controller;

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 13, 2026

@ujas-m-simformsolutions Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: d7529582-fce7-413f-a2f7-7ffeb3743609

Sorry for the inconvenience!

@ujas-m-simformsolutions
Copy link
Copy Markdown
Collaborator

ujas-m-simformsolutions commented Apr 13, 2026

@copilot try again

@ujas-m-simformsolutions
Copy link
Copy Markdown
Collaborator

@copilot add this two configs in riveConfig and use them and update pubspec with rive: ^0.14.5

/// The data bind to specify which view model instance to bind to.
  final DataBind? dataBind;

  /// An optional function to manually create the controller instead of using
  /// the default one.
  final Controller? controller;

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 13, 2026

@copilot add this two configs in riveConfig and use them and update pubspec with rive: ^0.14.5

/// The data bind to specify which view model instance to bind to.

...

Done in commit c3a096a:

  • Added dataBind (DataBind?) and controller (Controller?) fields to RiveConfig with doc comments
  • Both are forwarded to RiveWidgetBuilder in rive_splash.dart
  • Updated rive dependency to ^0.14.5 in pubspec.yaml

Copilot AI changed the title chore: 🚧 Provide support for rive pre-release feat!: Support Rive 0.14.x (pre-release) Apr 13, 2026
@ujas-m-simformsolutions ujas-m-simformsolutions force-pushed the copilot/support-rive-pre-release branch from c3a096a to 8679452 Compare April 15, 2026 06:43
@ujas-m-simformsolutions ujas-m-simformsolutions changed the title feat!: Support Rive 0.14.x (pre-release) chore: 🚧 Provide support for rive ^0.14.5 Apr 15, 2026
@apurva010
Copy link
Copy Markdown
Collaborator

Closing this PR as this has been handled in #94

@apurva010 apurva010 closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support Rive Pre-Release Versions in Splash Master

4 participants