Flutter release 0.13.5

Tested out the latest rive-common that now uses `package:web` and `dart:js_interop`

The `RiveFile.initializeText` and everything associated with it are deprecated. Instead, use `RiveFile.initialize`, which will always need to be called when initializing text, audio, and layout.

Calling it `initializeText` is confusing to users as they may not be using text, but still need to call this manually when using RiveFile.import.

There is maybe additional cleanup we could do here, but at least want to make sure the public API is not confusing.

Diffs=
fa7c55934 Flutter release 0.13.5 (#7305)
973ff2276 Fix warnings about invalid toolsets (#7300)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
This commit is contained in:
HayesGordon
2024-05-23 19:22:06 +00:00
parent a0e22e4250
commit 04d3908f57
10 changed files with 121 additions and 116 deletions

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:rive/rive.dart';
/// An example showing how to drive two boolean state machine inputs.
@ -11,11 +10,7 @@ class ExampleStateMachine extends StatefulWidget {
}
class _ExampleStateMachineState extends State<ExampleStateMachine> {
/// Tracks if the animation is playing by whether controller is running.
bool get isPlaying => _controller?.isActive ?? false;
Artboard? _riveArtboard;
StateMachineController? _controller;
SMIBool? _hoverInput;
SMIBool? _pressInput;
@ -23,26 +18,23 @@ class _ExampleStateMachineState extends State<ExampleStateMachine> {
void initState() {
super.initState();
// Load the animation file from the bundle, note that you could also
// download this. The RiveFile just expects a list of bytes.
rootBundle.load('assets/rocket.riv').then(
(data) async {
// Load the RiveFile from the binary data.
final file = RiveFile.import(data);
_loadRiveFile();
}
Future<void> _loadRiveFile() async {
// Load the animation file from the bundle.
final riveFile = await RiveFile.asset('assets/rocket.riv');
// The artboard is the root of the animation and gets drawn in the
// Rive widget.
final artboard = file.mainArtboard;
var controller =
StateMachineController.fromArtboard(artboard, 'Button');
if (controller != null) {
artboard.addController(controller);
_hoverInput = controller.getBoolInput('Hover');
_pressInput = controller.getBoolInput('Press');
}
setState(() => _riveArtboard = artboard);
},
);
// The artboard is the root of the animation and gets drawn in the
// Rive widget.
final artboard = riveFile.mainArtboard;
var controller = StateMachineController.fromArtboard(artboard, 'Button');
if (controller != null) {
artboard.addController(controller);
_hoverInput = controller.getBoolInput('Hover');
_pressInput = controller.getBoolInput('Press');
}
setState(() => _riveArtboard = artboard);
}
@override