mirror of
https://github.com/rive-app/rive-flutter
synced 2025-07-14 21:55:57 +00:00
Fixing issues reported on pub.dev.
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
library rive;
|
||||
|
||||
export 'package:rive/src/rive_core/node.dart';
|
||||
export 'package:rive/src/rive_core/transform_component.dart';
|
||||
export 'package:rive/src/rive_core/world_transform_component.dart';
|
||||
|
@ -1,4 +1,2 @@
|
||||
library rive;
|
||||
|
||||
export 'package:rive/src/rive_core/math/mat2d.dart';
|
||||
export 'package:rive/src/rive_core/math/vec2d.dart';
|
||||
|
5
lib/src/local_file_io.dart
Normal file
5
lib/src/local_file_io.dart
Normal file
@ -0,0 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
/// Load a list of bytes from a file on the local filesystem at [path].
|
||||
Future<Uint8List?> localFileBytes(String path) => File(path).readAsBytes();
|
5
lib/src/local_file_web.dart
Normal file
5
lib/src/local_file_web.dart
Normal file
@ -0,0 +1,5 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
/// Load a list of bytes from a file on the local filesystem at [path].
|
||||
Future<Uint8List?> localFileBytes(String path) =>
|
||||
throw UnsupportedError('Cannot load from a local file on the web.');
|
@ -33,5 +33,4 @@ abstract class TargetedConstraint extends TargetedConstraintBase {
|
||||
super.onAddedDirty();
|
||||
target = context.resolve(targetId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ abstract class NestedAnimation<T extends Animation>
|
||||
@override
|
||||
void animationIdChanged(int from, int to) {}
|
||||
|
||||
|
||||
bool get isEnabled;
|
||||
void advance(double elapsedSeconds, MountedArtboard mountedArtboard);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -16,12 +15,17 @@ import 'package:rive/src/generated/animation/exit_state_base.dart';
|
||||
import 'package:rive/src/generated/animation/keyed_property_base.dart';
|
||||
import 'package:rive/src/generated/animation/state_machine_base.dart';
|
||||
import 'package:rive/src/generated/nested_artboard_base.dart';
|
||||
import 'package:rive/src/local_file_io.dart'
|
||||
if (dart.library.html) 'package:rive/src/local_file_web.dart';
|
||||
import 'package:rive/src/rive_core/animation/blend_state_1d.dart';
|
||||
import 'package:rive/src/rive_core/animation/blend_state_direct.dart';
|
||||
import 'package:rive/src/rive_core/animation/keyed_object.dart';
|
||||
import 'package:rive/src/rive_core/animation/keyed_property.dart';
|
||||
import 'package:rive/src/rive_core/animation/layer_state.dart';
|
||||
import 'package:rive/src/rive_core/animation/linear_animation.dart';
|
||||
import 'package:rive/src/rive_core/animation/state_machine.dart';
|
||||
import 'package:rive/src/rive_core/animation/state_machine_layer.dart';
|
||||
import 'package:rive/src/rive_core/animation/state_transition.dart';
|
||||
import 'package:rive/src/rive_core/artboard.dart';
|
||||
import 'package:rive/src/rive_core/backboard.dart';
|
||||
import 'package:rive/src/rive_core/component.dart';
|
||||
@ -30,10 +34,6 @@ import 'package:rive/src/rive_core/runtime/runtime_header.dart';
|
||||
import 'package:rive/src/runtime_nested_artboard.dart';
|
||||
import 'package:rive/src/utilities/binary_buffer/binary_reader.dart';
|
||||
|
||||
import 'generated/animation/blend_state_1d_base.dart';
|
||||
import 'generated/animation/blend_state_direct_base.dart';
|
||||
import 'rive_core/animation/state_transition.dart';
|
||||
|
||||
Core<CoreContext>? _readRuntimeObject(
|
||||
BinaryReader reader, HashMap<int, CoreFieldType> propertyToField) {
|
||||
int coreObjectKey = reader.readVarUint();
|
||||
@ -257,9 +257,8 @@ class RiveFile {
|
||||
|
||||
/// Imports a Rive file from local folder
|
||||
static Future<RiveFile> file(String path) async {
|
||||
final file = File(path);
|
||||
final bytes = ByteData.view(file.readAsBytesSync().buffer);
|
||||
return RiveFile.import(bytes);
|
||||
final bytes = await localFileBytes(path);
|
||||
return RiveFile.import(ByteData.view(bytes!.buffer));
|
||||
}
|
||||
|
||||
/// Returns all artboards in the file
|
||||
|
Reference in New Issue
Block a user