Skip to content

Commit

Permalink
Merge branch 'warmth_fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-rosso committed Nov 7, 2019
2 parents 1e9b22e + 9ec074b commit b391dd4
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions flare_flutter/lib/flare_cache_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ class FlareCacheBuilder extends StatefulWidget {
}

class _FlareCacheBuilderState extends State<FlareCacheBuilder> {
bool isWarm = false;
bool _isWarm = false;
bool get isWarm => _isWarm;
set isWarm(bool value) {
if (value == _isWarm) {
return;
}
if (mounted) {
setState(() {
_isWarm = value;
});
}
}

final Set<FlareCacheAsset> _assets = {};
@override
void initState() {
Expand Down Expand Up @@ -62,24 +74,21 @@ class _FlareCacheBuilderState extends State<FlareCacheBuilder> {
}

bool _updateWarmth() {
if (!mounted) {
return true;
}
var filenames = widget.filenames;
if (filenames == null) {
setState(() {
isWarm = true;
});
isWarm = true;
return true;
}
for (final filename in filenames) {
if (getWarmActor(bundle, filename) == null) {
setState(() {
isWarm = false;
});
isWarm = false;
return false;
}
}
setState(() {
isWarm = true;
});
isWarm = true;
return true;
}

Expand Down

0 comments on commit b391dd4

Please sign in to comment.