Adds high level RiveAnimation widget

This commit is contained in:
matt Sullivan
2021-05-27 17:37:54 -07:00
parent 2c60e982c6
commit 1d54191031
8 changed files with 179 additions and 6 deletions

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:rive/rive.dart';
class ExampleAnimation extends StatefulWidget {

View File

@ -3,6 +3,7 @@ import 'package:rive_example/example_animation.dart';
import 'package:rive_example/example_state_machine.dart';
import 'package:rive_example/liquid_download.dart';
import 'package:rive_example/little_machine.dart';
import 'package:rive_example/simple_animation.dart';
import 'package:rive_example/state_machine_skills.dart';
void main() => runApp(MaterialApp(
@ -22,7 +23,21 @@ class Home extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton(
child: const Text('Animation'),
child: const Text('Simple Animation'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute<void>(
builder: (context) => const SimpleAnimation(),
),
);
},
),
const SizedBox(
height: 10,
),
ElevatedButton(
child: const Text('Play/Pause Animation'),
onPressed: () {
Navigator.push(
context,

View File

@ -0,0 +1,22 @@
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
class SimpleAnimation extends StatelessWidget {
const SimpleAnimation({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Simple Animation'),
),
body: const Center(
// child: RiveAnimation.asset('assets/off_road_car.riv'),
child: RiveAnimation.network(
'https://cdn.rive.app/animations/truck.riv',
fit: BoxFit.cover,
),
),
);
}
}

View File

@ -6,6 +6,8 @@
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>

View File

@ -1,5 +1,5 @@
name: rive_example
description: A new Flutter project.
description: A collection of Rive Flutter examples
publish_to: "none" # Remove this line if you wish to publish to pub.dev