feature_discovery icon indicating copy to clipboard operation
feature_discovery copied to clipboard

Feature background disapear randomly on addPostFrameCallback

Open EliuTimana opened this issue 4 years ago • 5 comments

when I have multiple features to show up at my ap startup the first one's background disappears randomly, even if I restart the app, it works perfectly when I activate it with a button.

Imgur

As you can see the feature's background disappears, I put a dark background to show you that the description text is there.

This is the result when I trigger the sequence with a button, everything OK.

Here is my code.

//helper class
class FeatureManager {
  static const keyMenuSearch = 'key_menu_search';
  static const keyButtonSearch = 'key_button_Search';
  static const featuresSearch = {keyMenuSearch, keyButtonSearch};
}

@override
void initState() {
  SchedulerBinding.instance.addPostFrameCallback((Duration duration) {
    showFeatures();
  });
    super.initState();
}

void showFeatures() {
    FeatureDiscovery.clearPreferences(context, FeatureManager.featuresSearch).then((_) {
      FeatureDiscovery.discoverFeatures(context, FeatureManager.featuresSearch);
    });
}

EliuTimana avatar Apr 01 '20 20:04 EliuTimana

After several attempts I found that this fixes the problem, I don't know why, I'm not an expert, but for now, it solves the problem.

One-second custom duration worked, less than that won't work.

  @override
  void initState() {
    SchedulerBinding.instance.addPostFrameCallback((Duration duration) {
      Future.delayed(Duration(seconds: 1)).then((_) {
        FeatureManager.showFeatures(context);
      });
    });
    super.initState();
  }

EliuTimana avatar Apr 01 '20 20:04 EliuTimana

Could you please tell if the problem also occurs if you use version 0.7.0 of this package?

axel-op avatar Apr 04 '20 19:04 axel-op

Could you please tell if the problem also occurs if you use version 0.7.0 of this package?

Nope, with 0.7.0 it works fine, but, what is the way to clear the preferences? I use the clearPreferences() functions to restart all the features, it doesn't exists in previous versions.

EliuTimana avatar Apr 05 '20 02:04 EliuTimana

Same problem version: "0.13.0"

kashlo avatar Dec 23 '20 16:12 kashlo

The latest version has the same problem v0.14.0

guoz2013 avatar Aug 08 '21 14:08 guoz2013