TesteurManiak / smart_banner

Display a smart banner on top of the screen of your Flutter Web application.
https://pub.dev/packages/smart_banner
MIT License
9 stars 1 forks source link

Conditionally show SmartBanner #4

Closed aytunch closed 1 year ago

aytunch commented 1 year ago

If we had a boolean property for the SmartBannerScaffold like isShown, then we could only show it for kIsWeb and mobile browsers. Our code base support native mobile and web so we only need to show it on the web mobile browsers. What do you think of this idea? A workaround is to conditionally wrap SmartBannerScaffold but it is not very clean imo.

TesteurManiak commented 1 year ago

SmartBannerScaffold is already relying on kIsWeb to display the banner but yeah it might be better to allow the dev to override the property 🤔

aytunch commented 1 year ago

I am glad you find there is a use case too. I understand the reasoning behind not showing banners on native apps. But when we use kIsWeb it shows the banner in desktop web, which does not make sense since user cant download the app from desktop Safari or Chrome. So developers can choose in which Platforms to show it. Furthermore, maybe the app is already installed.

Another valid use case is if we don't want to show the banner every time the user visits the web app. We can decide how many times to show it before giving up, not to be annoying, in Hive or somewhere similar.

aytunch commented 1 year ago

@TesteurManiak thank you :) When can we see the release on pub.dev? I see it still shows the old version.

TesteurManiak commented 1 year ago

It has been released just now 😉 https://pub.dev/packages/smart_banner/versions/0.2.2 Note that you can also point directly to the git repo if you don't want to wait the release on pub.dev:

dependencies:
  smart_banner:
    git:
      url: https://github.com/TesteurManiak/smart_banner
      ref: main