diff --git a/example/assets/blue_artboard.riv b/example/assets/blue_artboard.riv deleted file mode 100644 index 53252c8..0000000 Binary files a/example/assets/blue_artboard.riv and /dev/null differ diff --git a/example/assets/colors_juice.riv b/example/assets/colors_juice.riv deleted file mode 100644 index 4231d67..0000000 Binary files a/example/assets/colors_juice.riv and /dev/null differ diff --git a/example/assets/cubic_work.riv b/example/assets/cubic_work.riv deleted file mode 100644 index 8e85833..0000000 Binary files a/example/assets/cubic_work.riv and /dev/null differ diff --git a/example/assets/draworderanimation_3.riv b/example/assets/draworderanimation_3.riv deleted file mode 100644 index 29ea0ac..0000000 Binary files a/example/assets/draworderanimation_3.riv and /dev/null differ diff --git a/example/assets/jet_fighter.riv b/example/assets/jet_fighter.riv deleted file mode 100644 index 2cbbae7..0000000 Binary files a/example/assets/jet_fighter.riv and /dev/null differ diff --git a/example/assets/ping_pong.riv b/example/assets/ping_pong.riv deleted file mode 100644 index 0a513b8..0000000 Binary files a/example/assets/ping_pong.riv and /dev/null differ diff --git a/example/assets/tape_deck.riv b/example/assets/tape_deck.riv deleted file mode 100644 index 96fcaa6..0000000 Binary files a/example/assets/tape_deck.riv and /dev/null differ diff --git a/example/assets/teeny_tiny.riv b/example/assets/teeny_tiny.riv new file mode 100644 index 0000000..26b855d Binary files /dev/null and b/example/assets/teeny_tiny.riv differ diff --git a/example/assets/web_&_desktop_2.riv b/example/assets/web_&_desktop_2.riv deleted file mode 100644 index 09329cb..0000000 Binary files a/example/assets/web_&_desktop_2.riv and /dev/null differ diff --git a/example/lib/main.dart b/example/lib/main.dart index 88729b6..6b8fd0f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -44,7 +44,7 @@ class _MyHomePageState extends State { // 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/colors_juice.riv').then( + rootBundle.load('assets/teeny_tiny.riv').then( (data) async { var file = RiveFile(); // Load the RiveFile from the binary data. @@ -56,7 +56,7 @@ class _MyHomePageState extends State { // Add a controller to play back a known animation on the main/default // artboard.We store a reference to it so we can toggle playback. artboard.addController( - _controller = SimpleAnimation('walk'), + _controller = SimpleAnimation('idle'), ); setState(() => _riveArtboard = artboard); } diff --git a/lib/src/core/field_types/core_string_type.dart b/lib/src/core/field_types/core_string_type.dart index 1599a9c..cec1892 100644 --- a/lib/src/core/field_types/core_string_type.dart +++ b/lib/src/core/field_types/core_string_type.dart @@ -3,7 +3,8 @@ import 'package:rive/src/utilities/binary_buffer/binary_reader.dart'; class CoreStringType extends CoreFieldType { @override - String deserialize(BinaryReader reader) => reader.readString(); + String deserialize(BinaryReader reader) => + reader.readString(explicitLength: false); @override String lerp(String from, String to, double f) => from; diff --git a/lib/src/rive_core/runtime/runtime_header.dart b/lib/src/rive_core/runtime/runtime_header.dart index 231920f..333bb35 100644 --- a/lib/src/rive_core/runtime/runtime_header.dart +++ b/lib/src/rive_core/runtime/runtime_header.dart @@ -4,7 +4,7 @@ import 'package:rive/src/utilities/binary_buffer/binary_reader.dart'; import 'exceptions/rive_format_error_exception.dart'; class RuntimeHeader { - static const int majorVersion = 1; + static const int majorVersion = 2; static const int minorVersion = 0; static const String fingerprint = 'RIVE'; final int ownerId; diff --git a/lib/src/utilities/binary_buffer/binary_reader.dart b/lib/src/utilities/binary_buffer/binary_reader.dart index eb529b1..f2006c9 100644 --- a/lib/src/utilities/binary_buffer/binary_reader.dart +++ b/lib/src/utilities/binary_buffer/binary_reader.dart @@ -115,8 +115,8 @@ class BinaryReader { /// Read a string encoded into the stream. Strings are encoded with a varuint /// integer length written first followed by length number of utf8 encoded /// bytes. - String readString() { - int length = readVarUint(); + String readString({bool explicitLength = true}) { + int length = explicitLength ? readVarUint() : buffer.lengthInBytes; String value = _utf8Decoder.convert(Uint8List.view( buffer.buffer, buffer.offsetInBytes + _readIndex, length)); _readIndex += length; diff --git a/lib/src/utilities/binary_buffer/binary_writer.dart b/lib/src/utilities/binary_buffer/binary_writer.dart index 5c9a4af..1ef1ae7 100644 --- a/lib/src/utilities/binary_buffer/binary_writer.dart +++ b/lib/src/utilities/binary_buffer/binary_writer.dart @@ -151,9 +151,11 @@ class BinaryWriter { /// Encode a string into the buffer. Strings are encoded with a varuint /// integer length written first followed by length number of utf8 encoded /// bytes. - void writeString(String value) { + void writeString(String value, {bool explicitLength = true}) { var list = _utf8Encoder.convert(value); - writeVarUint(list.length); + if (explicitLength) { + writeVarUint(list.length); + } write(list); }