Skip to content

Commit

Permalink
Updating to latest Flare and Nima dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-rosso committed Jul 26, 2019
1 parent 2e00565 commit 855fd92
Show file tree
Hide file tree
Showing 15 changed files with 91 additions and 71 deletions.
Binary file modified app/assets/ExpandCollapse.flr
Binary file not shown.
2 changes: 1 addition & 1 deletion app/lib/article/article_widget.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flare/flare_actor.dart';
import 'package:flare_flutter/flare_actor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter/widgets.dart';
Expand Down
6 changes: 3 additions & 3 deletions app/lib/article/controllers/amelia_controller.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flare/flare.dart';
import 'package:flare/flare/math/mat2d.dart';
import 'package:flare/flare/math/vec2d.dart';
import 'package:flare_flutter/flare.dart';
import 'package:flare_dart/math/mat2d.dart';
import 'package:flare_dart/math/vec2d.dart';
import 'flare_interaction_controller.dart';

// "Amelia Earhart" Article Page contains a custom controller.
Expand Down
6 changes: 3 additions & 3 deletions app/lib/article/controllers/flare_interaction_controller.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flare/flare.dart' as flare;
import 'package:flare/flare/math/mat2d.dart' as flare;
import 'package:flare/flare/math/vec2d.dart' as flare;
import 'package:flare_flutter/flare.dart' as flare;
import 'package:flare_dart/math/mat2d.dart' as flare;
import 'package:flare_dart/math/vec2d.dart' as flare;

/// Controllers are used in our Flare library to provide custom behaviors for animations.
abstract class FlareInteractionController {
Expand Down
10 changes: 5 additions & 5 deletions app/lib/article/timeline_entry_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'dart:math';
import 'dart:ui';
import "dart:ui" as ui;

import 'package:flare/flare.dart' as flare;
import 'package:flare/flare/actor_image.dart' as flare;
import 'package:flare/flare/math/aabb.dart' as flare;
import 'package:flare/flare/math/mat2d.dart' as flare;
import 'package:flare/flare/math/vec2d.dart' as flare;
import 'package:flare_flutter/flare.dart' as flare;
import 'package:flare_dart/actor_image.dart' as flare;
import 'package:flare_dart/math/aabb.dart' as flare;
import 'package:flare_dart/math/mat2d.dart' as flare;
import 'package:flare_dart/math/vec2d.dart' as flare;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
Expand Down
2 changes: 1 addition & 1 deletion app/lib/main_menu/favorites_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flare/flare_actor.dart';
import 'package:flare_flutter/flare_actor.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:timeline/bloc_provider.dart';
Expand Down
46 changes: 24 additions & 22 deletions app/lib/main_menu/main_menu_section.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:timeline/main_menu/menu_data.dart';
import "package:flare/flare_actor.dart" as flare;
import "package:flare_flutter/flare_actor.dart" as flare;
import 'package:timeline/main_menu/menu_vignette.dart';

typedef NavigateTo(MenuItemData item);

/// This widget displays the single menu section of the [MainMenuWidget].
///
/// There are three main sections, as loaded from the menu.json file in the
///
/// There are three main sections, as loaded from the menu.json file in the
/// assets folder.
/// Each section has a backgroundColor, an accentColor, a background Flare asset,
/// and a list of elements it needs to display when expanded.
///
///
/// Since this widget expands and contracts when tapped, it needs to maintain a [State].
class MenuSection extends StatefulWidget {
final String title;
Expand All @@ -36,7 +36,6 @@ class MenuSection extends StatefulWidget {
/// This allows the animation to run smoothly and avoids consuming unnecessary resources.
class _SectionState extends State<MenuSection>
with SingleTickerProviderStateMixin {

/// The [AnimationController] is a Flutter Animation object that generates a new value
/// whenever the hardware is ready to draw a new frame.
AnimationController _controller;
Expand All @@ -54,7 +53,6 @@ class _SectionState extends State<MenuSection>
/// Detects which state the widget is currently in, and triggers the animation upon change.
bool _isExpanded = false;


/// Here we initialize the fields described above, and set up the widget to its initial state.
@override
initState() {
Expand All @@ -64,9 +62,11 @@ class _SectionState extends State<MenuSection>
vsync: this,
duration: const Duration(milliseconds: 200),
);
/// This curve is controlled by [_controller].

/// This curve is controlled by [_controller].
final CurvedAnimation curve =
CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn);

/// [_sizeAnimation] will interpolate using this curve - [Curves.fastOutSlowIn].
_sizeAnimation = _sizeTween.animate(curve);
_controller.addListener(() {
Expand Down Expand Up @@ -100,12 +100,12 @@ class _SectionState extends State<MenuSection>
}

/// This method wraps the whole widget in a [GestureDetector] to handle taps appropriately.
///
/// A custom [BoxDecoration] is used to render the rounded rectangle on the screen, and a
///
/// A custom [BoxDecoration] is used to render the rounded rectangle on the screen, and a
/// [MenuVignette] is used as a background decoration for the whole widget.
///
///
/// The [SizeTransition] opens up the section and displays the list underneath the section title.
///
///
/// Each section sub-element is wrapped into a [GestureDetector] too so that the Timeline can be displayed
/// when that element is tapped.
@override
Expand Down Expand Up @@ -135,16 +135,18 @@ class _SectionState extends State<MenuSection>
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 21.0,
width: 21.0,
margin: EdgeInsets.all(18.0),
/// Another [FlareActor] widget that
/// you can experiment with here: https://www.2dimensions.com/a/pollux/files/flare/expandcollapse/preview
child: flare.FlareActor(
"assets/ExpandCollapse.flr",
color: widget.accentColor,
animation:
_isExpanded ? "Collapse" : "Expand")),
height: 21.0,
width: 21.0,
margin: EdgeInsets.all(18.0),

/// Another [FlareActor] widget that
/// you can experiment with here: https://www.2dimensions.com/a/pollux/files/flare/expandcollapse/preview
child: flare.FlareActor(
"assets/ExpandCollapse.flr",
color: widget.accentColor,
animation:
_isExpanded ? "Collapse" : "Expand"),
),
Text(
widget.title,
style: TextStyle(
Expand Down Expand Up @@ -197,4 +199,4 @@ class _SectionState extends State<MenuSection>
],
))));
}
}
}
4 changes: 2 additions & 2 deletions app/lib/main_menu/menu_vignette.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:math';
import 'dart:ui';
import 'dart:ui' as ui;

import 'package:flare/flare/actor_image.dart' as flare;
import 'package:flare/flare/math/aabb.dart' as flare;
import 'package:flare_dart/actor_image.dart' as flare;
import 'package:flare_dart/math/aabb.dart' as flare;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
Expand Down
12 changes: 7 additions & 5 deletions app/lib/timeline/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import 'dart:math';
import 'dart:typed_data';
import 'dart:ui' as ui;

import 'package:flare/flare.dart' as flare;
import 'package:flare/flare/animation/actor_animation.dart' as flare;
import 'package:flare/flare/math/aabb.dart' as flare;
import 'package:flare/flare/math/vec2d.dart' as flare;
import 'package:flare_flutter/flare.dart' as flare;
import 'package:flare_dart/animation/actor_animation.dart' as flare;
import 'package:flare_dart/math/aabb.dart' as flare;
import 'package:flare_dart/math/vec2d.dart' as flare;
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart' show rootBundle;
Expand Down Expand Up @@ -437,7 +437,7 @@ class Timeline {
actor = flare.FlutterActor();

/// Flare library function to load the [FlutterActor]
bool success = await actor.loadFromBundle(filename);
bool success = await actor.loadFromBundle(rootBundle, filename);
if (success) {
/// Populate the Map.
_flareResources[filename] = actor;
Expand All @@ -446,7 +446,9 @@ class Timeline {
if (actor != null) {
/// Distinguish between the actual actor, and its intance.
flareAsset.actorStatic = actor.artboard;
flareAsset.actorStatic.initializeGraphics();
flareAsset.actor = actor.artboard.makeInstance();
flareAsset.actor.initializeGraphics();
/// and the reference to their first animation is grabbed.
flareAsset.animation = actor.artboard.animations[0];

Expand Down
8 changes: 4 additions & 4 deletions app/lib/timeline/timeline_entry.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'dart:ui' as ui;
import 'dart:ui';

import 'package:flare/flare.dart' as flare;
import 'package:flare/flare/animation/actor_animation.dart' as flare;
import 'package:flare/flare/math/aabb.dart' as flare;
import 'package:flare/flare/math/vec2d.dart' as flare;
import 'package:flare_flutter/flare.dart' as flare;
import 'package:flare_dart/animation/actor_animation.dart' as flare;
import 'package:flare_dart/math/aabb.dart' as flare;
import 'package:flare_dart/math/vec2d.dart' as flare;
import 'package:nima/nima.dart' as nima;
import 'package:nima/nima/animation/actor_animation.dart' as nima;
import 'package:nima/nima/math/aabb.dart' as nima;
Expand Down

0 comments on commit 855fd92

Please sign in to comment.