mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-08-06 16:40:27 +08:00

- Adds checks to see if a drawable has a 0% opacity before performing draw commands - Add skinning example Diffs= a61f4c6b5 apply changes to rive_core 8152b8a02 docs: update CHANGELOG b8f61022c perf: check if opacity is 0 before drawing 4c4826e67 chore: add typedef argument names ff94982f9 docs: add skinning sample f1ddd88d4 Fix artboard pieces slowly popping in. (#4818) 3039909c2 Update to using deployment workflow similar to ios 53a8f9517 Fix direction when looping. (#4786) 4c5a576ad Fix ping pong hang (#4776) ae1e02afc Fix tess test linking (#4773) 4ecbf9321 Fix remap based on issue JC caught. (#4771) 89e38b700 allow negative speed (#4770) 4d115b4c6 Adding GLSL100 for tess renderer. (#4767) 31a3972aa ios shaders for tess (#4765) 686e5125b Add dependency to correct grand parent for linear gradients. (#4753) e737ee427 Revert "Update to using deployment workflow similar to ios" de0e57d55 Update to using deployment workflow similar to ios 051769242 Runtime Text! (#4741) 331ad0d55 Build cleanups 2538229d6 Use Rive's libpng premake dependency in golden testing 42a0377bc Fix condition with trim paths where all contours are 0 length. (#4722) ea1c83d02 Use os.copyfile() instead of the '{COPY}' command 5c03e1640 Remove forcing arch to arm64 for libpng (#4715) 404a04d35 Cleaning up libpng premake to be isolated/stand-alone. (#4713)
115 lines
3.6 KiB
Dart
115 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rive_example/carousel.dart';
|
|
import 'package:rive_example/custom_controller.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/play_one_shot_animation.dart';
|
|
import 'package:rive_example/play_pause_animation.dart';
|
|
import 'package:rive_example/simple_animation.dart';
|
|
import 'package:rive_example/simple_animation_network.dart';
|
|
import 'package:rive_example/simple_machine_listener.dart';
|
|
import 'package:rive_example/simple_state_machine.dart';
|
|
import 'package:rive_example/skinning_demo.dart';
|
|
import 'package:rive_example/state_machine_skills.dart';
|
|
|
|
void main() => runApp(
|
|
MaterialApp(
|
|
title: 'Rive Example',
|
|
home: const RiveExampleApp(),
|
|
darkTheme: ThemeData.dark().copyWith(
|
|
scaffoldBackgroundColor: _backgroundColor,
|
|
appBarTheme: const AppBarTheme(backgroundColor: _appBarColor),
|
|
colorScheme:
|
|
ColorScheme.fromSwatch().copyWith(primary: _primaryColor),
|
|
),
|
|
themeMode: ThemeMode.dark,
|
|
),
|
|
);
|
|
|
|
/// An example application demoing Rive.
|
|
class RiveExampleApp extends StatefulWidget {
|
|
const RiveExampleApp({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<RiveExampleApp> createState() => _RiveExampleAppState();
|
|
}
|
|
|
|
class _RiveExampleAppState extends State<RiveExampleApp> {
|
|
// Example animations
|
|
final _pages = [
|
|
const _Page('Simple Animation - Asset', SimpleAssetAnimation()),
|
|
const _Page('Simple Animation - Network', SimpleNetworkAnimation()),
|
|
const _Page('Play/Pause Animation', PlayPauseAnimation()),
|
|
const _Page('Play One-Shot Animation', PlayOneShotAnimation()),
|
|
const _Page('Button State Machine', ExampleStateMachine()),
|
|
const _Page('Skills Machine', StateMachineSkills()),
|
|
const _Page('Little Machine', LittleMachine()),
|
|
const _Page('Liquid Download', LiquidDownload()),
|
|
const _Page('Custom Controller - Speed', SpeedyAnimation()),
|
|
const _Page('Simple State Machine', SimpleStateMachine()),
|
|
const _Page('State Machine with Listener', StateMachineListener()),
|
|
const _Page('Skinning Demo', SkinningDemo()),
|
|
const _Page('Animation Carousel', AnimationCarousel()),
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Rive Examples')),
|
|
body: Center(
|
|
child: ListView.separated(
|
|
shrinkWrap: true,
|
|
itemBuilder: (context, index) => _NavButton(page: _pages[index]),
|
|
separatorBuilder: (context, index) => const SizedBox(height: 16),
|
|
itemCount: _pages.length,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Class used to organize demo pages.
|
|
class _Page {
|
|
final String name;
|
|
final Widget page;
|
|
|
|
const _Page(this.name, this.page);
|
|
}
|
|
|
|
/// Button to navigate to demo pages.
|
|
class _NavButton extends StatelessWidget {
|
|
const _NavButton({required this.page});
|
|
|
|
final _Page page;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: ElevatedButton(
|
|
child: SizedBox(
|
|
width: 250,
|
|
child: Center(
|
|
child: Text(
|
|
page.name,
|
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
),
|
|
onPressed: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute<void>(
|
|
builder: (context) => page.page,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
const _appBarColor = Color(0xFF323232);
|
|
const _backgroundColor = Color(0xFF1D1D1D);
|
|
const _primaryColor = Color(0xFF57A5E0);
|