Comments (5)
What's the use case/flow you're using that's triggering a detach but not a dispose? I'd like to be able to test this condition.
Is it related to navigation?
from flare-flutter.
In the meantime I have pushed a fix for this and have updated the package on pub as well. Please let me know the workflow to trigger a test case for this.
from flare-flutter.
@luigi-rosso, About this issue. This is flutter behavior.
Pages on Navigator stack rebuild when a new page is pushed#11655
FlareActor will be rebuilding after navigator to another page.
For the performance, The developer needs to pause the FlareActor when going to another page and resume FlareActor when back.
This is Penguin demo.
class _MyHomePageState extends State<MyHomePage> implements FlareController {
double _rockAmount = 0.5;
double _speed = 1.0;
double _rockTime = 0.0;
bool _isPaused = false;
ActorAnimation _rock;
void initialize(FlutterActorArtboard artboard) {
_rock = artboard.getAnimation("music_walk");
}
void setViewTransform(Mat2D viewTransform) {}
bool advance(FlutterActorArtboard artboard, double elapsed) {
print("advance ");
_rockTime += elapsed * _speed;
_rock.apply(_rockTime % _rock.duration, artboard, _rockAmount);
return true;
}
@override
void dispose() {
print("dispose ");
super.dispose();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.grey,
appBar: new AppBar(title: new Text(widget.title)),
body: new Stack(
children: [
Positioned.fill(
child: FlareActor("assets/Penguin.flr",
alignment: Alignment.center,
isPaused: _isPaused,
fit: BoxFit.cover,
animation: "walk",
controller: this)),
Positioned.fill(
child: new Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
height: 220,
color: Colors.black.withOpacity(0.5),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text("Mix Amount",
style: TextStyle(color: Colors.white)),
new Slider(
value: _rockAmount,
min: 0.0,
max: 1.0,
divisions: null,
onChanged: (double value) {
setState(() {
_rockAmount = value;
});
},
),
new Text("Speed",
style: TextStyle(color: Colors.white)),
new Slider(
value: _speed,
min: 0.2,
max: 3.0,
divisions: null,
onChanged: (double value) {
setState(() {
_speed = value;
});
},
),
new Text("Paused",
style: TextStyle(color: Colors.white)),
new Checkbox(
value: _isPaused,
onChanged: (bool value) {
setState(() {
_isPaused = value;
});
},
),
Padding(
padding: EdgeInsets.only(left: 10.0),
child: RaisedButton(
onPressed: () {
_isPaused = true;
_openPage();
},
child: Text("Next Page"),
),
)
],
)),
]))
],
),
);
}
_openPage() async {
var result = await Navigator.push(
context,
MaterialPageRoute(builder: (context) => NextPage()),
);
_isPaused = false;
}
}
from flare-flutter.
Thanks for the example! Are still seeing this issue with the latest Flare-Flutter update?
from flare-flutter.
@luigi-rosso, This issue still happened on Flutter v1.1.4
from flare-flutter.
Related Issues (20)
- Migrate to null safety HOT 8
- Add debug mode HOT 1
- Migration to Null-Safety HOT 3
- Request for Clarification: Flare-Flutter vs Rive Flutter Runtime Use Cases HOT 4
- LateInitializationError HOT 8
- Null Safety for flare_dart HOT 3
- Placeholder widget while animation is loading
- 3.0.0 antialiasing no longer working HOT 13
- IK Constraints not working HOT 4
- Difference between flare-flutter and rive-flutter HOT 4
- FlutterActorImage not visible FlareActor
- Clear Memory after finish an animation HOT 2
- Can't load FlareActor.bundle on Android HOT 2
- Unhandled Exception: Exception: LateInitializationError: Field '_paint@235459774' has not been initialized HOT 2
- LateInitializationError: Field '_paint@xxxxxx' has not been initialized HOT 2
- LateInitializationError: Field '_setupAABB@43245341' has not been initialized HOT 1
- Flutter 2.10 & 3.0 throw warnings during compilation HOT 3
- Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null. HOT 4
- update HOT 1
- Flutter3 Error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flare-flutter.