mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-06-27 02:07:12 +08:00
Adds high level RiveAnimation widget
This commit is contained in:
@ -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 {
|
||||
|
@ -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,
|
||||
|
22
example/lib/simple_animation.dart
Normal file
22
example/lib/simple_animation.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user