animated_splash icon indicating copy to clipboard operation
animated_splash copied to clipboard

Problem in customFunction

Open ferdinandocecchini opened this issue 4 years ago • 4 comments

I noted that the customFunction is executed repeatedly. Is this an expected behavior? I set a duration of 5 seconds and during this time the following simple customFunction get executed 3 times (this function is just to test the outputAndHome parameter):

Function duringSplash = () {
    int rnd = Random().nextInt(10);
    print('rnd $rnd');
    return rnd 

Into the console you can see 3 times the value of rnd variable.

ferdinandocecchini avatar Apr 11 '20 22:04 ferdinandocecchini

No, it should execute only once. But yeah I observed initState getting called multiple times in flutter app while using hot reload. Did you see that behavior in a normal run without hot reload.

fayaz07 avatar Apr 12 '20 04:04 fayaz07

Yes, it happens even with a normal start. I've just launched Android Studio, started the IOS Simulator and click on Run button and this is the result: image

ferdinandocecchini avatar Apr 12 '20 10:04 ferdinandocecchini

Hi @ferdinandocecchini , yeah I actually gone through the issue and I had to make lot of changes there. I will publish the changes in the next version

fayaz07 avatar Apr 16 '20 18:04 fayaz07

I made some small changes to the code like:

  • custom background color
  • The Image parameter can be any type of image (.asset, .networkimage, ...)
  • you can enter multiple lines of text on the home screen and set the distance from the image If you wish, I can send you the dart file so that we can integrate this simple improvements into the next version (if you think they can be interesting!)

ferdinandocecchini avatar Apr 16 '20 18:04 ferdinandocecchini