mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 00:30:12 +08:00
[flutter] Clean-up
This commit is contained in:
parent
a2c752d855
commit
cb32efcb28
@ -4,8 +4,6 @@ The spine-flutter runtime provides functionality to load, manipulate and render
|
||||
|
||||
# See the [spine-flutter documentation](https://esotericsoftware.com/spine-flutter) for in-depth information.
|
||||
|
||||
The `spine_flutter` package name was previously used to publish the [Spine Flutter Runtime in plain Dart](https://github.com/jtakakura/spine_flutter/) by Junji Takakura. Junji has kindly transferred the package name to us and is now publishing his Dart-only Spine Flutter Runtime under the package name [spine_flutter_dart](https://pub.dev/packages/spine_flutter_dart).
|
||||
|
||||
## Licensing
|
||||
|
||||
You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge.
|
||||
@ -18,16 +16,12 @@ For the official legal terms governing the Spine Runtimes, please read the [Spin
|
||||
|
||||
## Spine version
|
||||
|
||||
spine-flutter works with data exported from Spine 4.2.xx.
|
||||
spine-flutter works with data exported from Spine 4.3.xx.
|
||||
|
||||
spine-flutter supports all Spine features, except two-color tinting and the screen blend mode.
|
||||
|
||||
## Supported platforms
|
||||
The spine-flutter runtime works on desktop, mobile and web. Web deployment requires canvaskit, which will add about 2mb of dependencies to your web deployment. You can compile your app for web with Canvaskit like this:
|
||||
|
||||
```
|
||||
flutter build web --web-renderer canvaskit
|
||||
```
|
||||
The spine-flutter runtime works on desktop, mobile and web.
|
||||
|
||||
## Setup
|
||||
To add `spine_flutter` to your Flutter project, add the following dependency to your `pubspec.yaml` file:
|
||||
@ -35,29 +29,21 @@ To add `spine_flutter` to your Flutter project, add the following dependency to
|
||||
```yaml
|
||||
dependencies:
|
||||
...
|
||||
spine_flutter: ^4.2.11
|
||||
# See https://pub.dev/packages/spine_flutter for the latest version
|
||||
spine_flutter: ^4.3.0
|
||||
```
|
||||
|
||||
In your `main()`, add these two lines in the beginning to initialize the Spine Flutter runtime:
|
||||
In your `main()`, add this line in the beginning to initialize the Spine Flutter runtime:
|
||||
|
||||
```dart
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
void main() async {
|
||||
await initSpineFlutter(enableMemoryDebugging: false);
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
## Example
|
||||
If you have pulled the `spine_flutter` package from [pub.dev](https://pub.dev) directly, you can run the example in the `example/` folder as is:
|
||||
|
||||
```bash
|
||||
cd path/to/downloaded/spine_flutter
|
||||
cd example
|
||||
flutter run
|
||||
```
|
||||
|
||||
Otherwise you can run the example like this:
|
||||
You can run the example like this:
|
||||
|
||||
1. install the [Flutter SDK](https://docs.flutter.dev/get-started/install), then run `flutter doctor` which will instruct you what other dependencies to install.
|
||||
2. Clone this repository `git clone https://github.com/esotericsoftware/spine-runtimes`
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
///
|
||||
/// Spine Runtimes License Agreement
|
||||
/// Last updated April 5, 2025. Replaces all prior versions.
|
||||
///
|
||||
/// Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
///
|
||||
/// Integration of the Spine Runtimes into software or otherwise creating
|
||||
/// derivative works of the Spine Runtimes is permitted under the terms and
|
||||
/// conditions of Section 2 of the Spine Editor License Agreement:
|
||||
/// http://esotericsoftware.com/spine-editor-license
|
||||
///
|
||||
/// Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
/// or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
/// "Products"), provided that each user of the Products must obtain their own
|
||||
/// Spine Editor license and redistribution of the Products in any form must
|
||||
/// include this license and copyright notice.
|
||||
///
|
||||
/// THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
/// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
/// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
/// DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
/// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
/// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
/// BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
/// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
/// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
/// THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
///
|
||||
|
||||
import 'package:spine_flutter/spine_flutter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AnimatedLogin extends StatelessWidget {
|
||||
const AnimatedLogin({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
reportLeaks();
|
||||
final controller = SpineWidgetController(
|
||||
onInitialized: (controller) {
|
||||
controller.skeleton.setSkin("nate");
|
||||
controller.skeleton.setupPose();
|
||||
controller.animationState.setAnimation(0, "login/look-left-down", true);
|
||||
},
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Animated login')),
|
||||
body: Container(
|
||||
margin: const EdgeInsets.all(15.0),
|
||||
padding: const EdgeInsets.all(3.0),
|
||||
decoration: BoxDecoration(border: Border.all(color: Colors.blueAccent)),
|
||||
child: SpineWidget.fromAsset(
|
||||
"assets/chibi/chibi-stickers.atlas",
|
||||
"assets/chibi/chibi-stickers.skel",
|
||||
controller,
|
||||
boundsProvider: SkinAndAnimationBounds(skins: ["nate"], animation: "login/look-left-down"),
|
||||
sizedByBounds: true,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,6 @@ class ExampleSelector extends StatelessWidget {
|
||||
}
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await initSpineFlutter(enableMemoryDebugging: false);
|
||||
runApp(const MaterialApp(title: "Spine Examples", home: ExampleSelector()));
|
||||
}
|
||||
|
||||
@ -5,5 +5,6 @@
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user