You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Blob.animatedRandom, the duration of the animated blob seems to be stuck to the initial value, even if it is changed using setState in a StatefulWidget.
Here is the test app running on an Android 11.0 (API 30) emulator. Pressing the FAB button assigns a random duration and a random color. So the duration keeps changing (as reflected in the app bar), but the animation of the blob shape doesn't seem to change its rythm:
blobs_duration_test_2.mp4
...
class_HomeScreenStateextendsState<HomeScreen> {
finalRandom _random =Random();
Color _color =Colors.blueGrey;
// The duration of the animated blob seems to be stuck to this initial value, even if we change it using setState.int _duration =500;
@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar:AppBar(
title:Text('Duration: $_duration milliseconds'), // display the current duration
),
body:Blob.animatedRandom(
size:400,
edgesCount:6,
minGrowth:7,
// Apply the current color - this works.
styles:BlobStyles(color: _color),
loop:true,
// Apply the current duration - doesn't seem to work!
duration:Duration(milliseconds: _duration),
),
floatingActionButton:FloatingActionButton(
child:constIcon(Icons.shuffle),
onPressed: () =>setState(() {
// Randomize the duration and the color
_duration = _random.nextInt(20) *500;
_color =Color.fromRGBO(_random.nextInt(256), _random.nextInt(256), _random.nextInt(256), 1.0);
}),
),
);
}
}
When using
Blob.animatedRandom
, the duration of the animated blob seems to be stuck to the initial value, even if it is changed usingsetState
in aStatefulWidget
.Here is the test app running on an Android 11.0 (API 30) emulator. Pressing the FAB button assigns a random duration and a random color. So the duration keeps changing (as reflected in the app bar), but the animation of the blob shape doesn't seem to change its rythm:
blobs_duration_test_2.mp4
(See the full code).
The text was updated successfully, but these errors were encountered: