From 9db1dbfe8556c80a4386baca0ea6d2ac852621b6 Mon Sep 17 00:00:00 2001
From: matt Sullivan <matt.j.sullivan@gmail.com>
Date: Thu, 10 Jun 2021 14:55:17 -0700
Subject: [PATCH 1/5] Replace univeral_io dependency with http

---
 lib/src/widgets/rive_animation.dart | 40 ++++++++++++++++-------------
 pubspec.yaml                        |  4 +--
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/lib/src/widgets/rive_animation.dart b/lib/src/widgets/rive_animation.dart
index 071fe3d..9075c3e 100644
--- a/lib/src/widgets/rive_animation.dart
+++ b/lib/src/widgets/rive_animation.dart
@@ -4,7 +4,7 @@ import 'package:flutter/services.dart';
 import 'package:flutter/widgets.dart';
 import 'package:rive/rive.dart';
 import 'package:rive/src/rive_core/artboard.dart';
-import 'package:universal_io/io.dart';
+import 'package:http/http.dart' as http;
 
 enum _Source {
   asset,
@@ -22,6 +22,7 @@ class RiveAnimation extends StatefulWidget {
   final List<String> stateMachines;
   final BoxFit? fit;
   final Alignment? alignment;
+
   /// Widget displayed while the rive is loading.
   final Widget? placeHolder;
 
@@ -83,24 +84,27 @@ class _RiveAnimationState extends State<RiveAnimation> {
 
   /// Loads a Rive file from an HTTP source and configures artboard, animation,
   /// and controller.
-  void _loadNetwork() {
-    final client = HttpClient();
-    final contents = <int>[];
+  Future<void> _loadNetwork() async {
+    final res = await http.get(Uri.parse(widget.name));
+    final data = ByteData.view(res.bodyBytes.buffer);
+    _init(data);
+    // final client = HttpClient();
+    // final contents = <int>[];
 
-    client
-        .getUrl(Uri.parse(widget.name))
-        .then(
-          (req) async => req.close(),
-        )
-        .then(
-          (res) => res.listen(
-            contents.addAll,
-            onDone: () {
-              final data = ByteData.view(Uint8List.fromList(contents).buffer);
-              _init(data);
-            },
-          ),
-        );
+    // client
+    //     .getUrl(Uri.parse(widget.name))
+    //     .then(
+    //       (req) async => req.close(),
+    //     )
+    //     .then(
+    //       (res) => res.listen(
+    //         contents.addAll,
+    //         onDone: () {
+    //           final data = ByteData.view(Uint8List.fromList(contents).buffer);
+    //           _init(data);
+    //         },
+    //       ),
+    //     );
   }
 
   /// Initializes the artboard, animation, and controller
diff --git a/pubspec.yaml b/pubspec.yaml
index 265f335..63df537 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
 name: rive
 description: Rive 2 Flutter Runtime. This package provides runtime functionality for playing back and interacting with animations built with the Rive editor available at https://rive.app.
-version: 0.7.15
+version: 0.7.16
 repository: https://github.com/rive-app/rive-flutter
 homepage: https://rive.app
 
@@ -12,8 +12,8 @@ dependencies:
   flutter:
     sdk: flutter
   graphs: ^2.0.0
+  http: ^0.13.3
   meta: ^1.3.0
-  universal_io: ^2.0.4
 
 dev_dependencies:
   flutter_test:

From ec8002ea05de842ad502aa906a7a80d8007b83d4 Mon Sep 17 00:00:00 2001
From: matt Sullivan <matt.j.sullivan@gmail.com>
Date: Fri, 11 Jun 2021 13:49:03 -0700
Subject: [PATCH 2/5] Exposes antialiasing option in Rive and RiveAnimation

---
 example/lib/simple_animation.dart   |  1 +
 lib/src/rive.dart                   | 11 +++++++++
 lib/src/widgets/rive_animation.dart | 38 +++++++++++++++--------------
 3 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/example/lib/simple_animation.dart b/example/lib/simple_animation.dart
index c15b1ef..a5b51b9 100644
--- a/example/lib/simple_animation.dart
+++ b/example/lib/simple_animation.dart
@@ -15,6 +15,7 @@ class SimpleAnimation extends StatelessWidget {
         child: RiveAnimation.network(
           'https://cdn.rive.app/animations/vehicles.riv',
           fit: BoxFit.cover,
+          antialiasing: false,
         ),
       ),
     );
diff --git a/lib/src/rive.dart b/lib/src/rive.dart
index f02d229..99896ac 100644
--- a/lib/src/rive.dart
+++ b/lib/src/rive.dart
@@ -6,6 +6,7 @@ import 'package:rive/src/rive_render_box.dart';
 import 'package:rive/src/runtime_artboard.dart';
 
 class Rive extends LeafRenderObjectWidget {
+  /// Artboard used for drawing
   final Artboard artboard;
 
   /// Determines whether to use the inherent size of the [artboard], i.e. the
@@ -27,12 +28,19 @@ class Rive extends LeafRenderObjectWidget {
   /// this to `true`.
   final bool useArtboardSize;
 
+  /// Fit for the rendering artboard
   final BoxFit fit;
+
+  /// Alignment for the rendering artboard
   final Alignment alignment;
 
+  /// Enables/disables anitalising
+  final bool antialiasing;
+
   const Rive({
     required this.artboard,
     this.useArtboardSize = false,
+    this.antialiasing = true,
     BoxFit? fit,
     Alignment? alignment,
   })  : fit = fit ?? BoxFit.contain,
@@ -40,6 +48,8 @@ class Rive extends LeafRenderObjectWidget {
 
   @override
   RenderObject createRenderObject(BuildContext context) {
+    // Doing this here and not in constructor so it can remain const
+    artboard.antialiasing = antialiasing;
     return RiveRenderObject(artboard as RuntimeArtboard)
       ..fit = fit
       ..alignment = alignment
@@ -50,6 +60,7 @@ class Rive extends LeafRenderObjectWidget {
   @override
   void updateRenderObject(
       BuildContext context, covariant RiveRenderObject renderObject) {
+    artboard.antialiasing = antialiasing;
     renderObject
       ..artboard = artboard
       ..fit = fit
diff --git a/lib/src/widgets/rive_animation.dart b/lib/src/widgets/rive_animation.dart
index 9075c3e..6857c48 100644
--- a/lib/src/widgets/rive_animation.dart
+++ b/lib/src/widgets/rive_animation.dart
@@ -15,15 +15,31 @@ enum _Source {
 /// animation are not specified, the default artboard and first animation fonund
 /// within it are used.
 class RiveAnimation extends StatefulWidget {
+  /// The asset name or url
   final String name;
+
+  /// The type of source used to retrieve the asset
   final _Source src;
+
+  /// The name of the artboard to use; default artboard if not specified
   final String? artboard;
+
+  /// List of animations to play; default animation if not specified
   final List<String> animations;
+
+  /// List of state machines to play; none will play if not specified
   final List<String> stateMachines;
+
+  /// Fit for the animation in the widget
   final BoxFit? fit;
+
+  /// Alignment for the animation in the widget
   final Alignment? alignment;
 
-  /// Widget displayed while the rive is loading.
+  /// Enable/disable antialiasing when rendering
+  final bool antialiasing;
+
+  /// Widget displayed while the rive is loading
   final Widget? placeHolder;
 
   /// Creates a new RiveAnimation from an asset bundle
@@ -35,6 +51,7 @@ class RiveAnimation extends StatefulWidget {
     this.fit,
     this.alignment,
     this.placeHolder,
+    this.antialiasing = true,
   }) : src = _Source.asset;
 
   const RiveAnimation.network(
@@ -45,6 +62,7 @@ class RiveAnimation extends StatefulWidget {
     this.fit,
     this.alignment,
     this.placeHolder,
+    this.antialiasing = true,
   }) : src = _Source.network;
 
   @override
@@ -88,23 +106,6 @@ class _RiveAnimationState extends State<RiveAnimation> {
     final res = await http.get(Uri.parse(widget.name));
     final data = ByteData.view(res.bodyBytes.buffer);
     _init(data);
-    // final client = HttpClient();
-    // final contents = <int>[];
-
-    // client
-    //     .getUrl(Uri.parse(widget.name))
-    //     .then(
-    //       (req) async => req.close(),
-    //     )
-    //     .then(
-    //       (res) => res.listen(
-    //         contents.addAll,
-    //         onDone: () {
-    //           final data = ByteData.view(Uint8List.fromList(contents).buffer);
-    //           _init(data);
-    //         },
-    //       ),
-    //     );
   }
 
   /// Initializes the artboard, animation, and controller
@@ -157,6 +158,7 @@ class _RiveAnimationState extends State<RiveAnimation> {
           artboard: _artboard!,
           fit: widget.fit,
           alignment: widget.alignment,
+          antialiasing: widget.antialiasing,
         )
       : widget.placeHolder ?? const SizedBox();
 }

From 19245676518bcd18148bf7c91fa17cfeeaf39871 Mon Sep 17 00:00:00 2001
From: matt Sullivan <matt.j.sullivan@gmail.com>
Date: Fri, 11 Jun 2021 13:53:54 -0700
Subject: [PATCH 3/5] Updates docs

---
 CHANGELOG.md | 5 ++++-
 README.md    | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 00a03da..4d0a503 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
+## [0.7.16] - 2021-06-11 12:00:00
+- Exposes antialiasing option in Rive and RiveAnimation widgets.
+
 ## [0.7.15] - 2021-06-10 12:00:00
-- Adds linear animation and state machine getters to RuntimeArtboard
+- Adds linear animation and state machine getters to RuntimeArtboard.
 - RiveAnimation now takes lists of animation and state machine names and plays all of them.
 
 ## [0.7.14] - 2021-06-10 11:57:35
diff --git a/README.md b/README.md
index eb7a8f4..1a17fe8 100644
--- a/README.md
+++ b/README.md
@@ -154,6 +154,6 @@ _controller.isActiveChanged.addListener(() {
 }
 ```
 
-## More Info
+## Antialiasing
 
-For an in-depth tutorial on how to use the runtime, check out [this blog post](https://blog.rive.app/rives-flutter-runtime-part-1/).
+If you want to disable antialiasing (usually for performance reasons), you can set `antialiasing` to `false` on the `Rive` and `RiveAnimation` widgets.

From 210232293756e750a5fa05035e3dc04b0b8e1146 Mon Sep 17 00:00:00 2001
From: matt Sullivan <matt.j.sullivan@gmail.com>
Date: Fri, 11 Jun 2021 17:19:10 -0700
Subject: [PATCH 4/5] Tweak example, bump version

---
 example/lib/simple_animation.dart | 2 --
 1 file changed, 2 deletions(-)

diff --git a/example/lib/simple_animation.dart b/example/lib/simple_animation.dart
index a5b51b9..fc7aa50 100644
--- a/example/lib/simple_animation.dart
+++ b/example/lib/simple_animation.dart
@@ -11,11 +11,9 @@ class SimpleAnimation extends StatelessWidget {
         title: const Text('Simple Animation'),
       ),
       body: const Center(
-        // child: RiveAnimation.asset('assets/off_road_car.riv'),
         child: RiveAnimation.network(
           'https://cdn.rive.app/animations/vehicles.riv',
           fit: BoxFit.cover,
-          antialiasing: false,
         ),
       ),
     );

From b972691634c231e801d06824e1ca51901b25eaeb Mon Sep 17 00:00:00 2001
From: matt Sullivan <matt.j.sullivan@gmail.com>
Date: Fri, 11 Jun 2021 17:19:29 -0700
Subject: [PATCH 5/5] Bump version

---
 pubspec.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pubspec.yaml b/pubspec.yaml
index 63df537..451917e 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
 name: rive
 description: Rive 2 Flutter Runtime. This package provides runtime functionality for playing back and interacting with animations built with the Rive editor available at https://rive.app.
-version: 0.7.16
+version: 0.7.17
 repository: https://github.com/rive-app/rive-flutter
 homepage: https://rive.app