purefundev / flutter_cookie_consent

https://pub.dev/packages/cookie_consent
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Display a cookie consent banner in your Flutter app or website.

Features

Getting started

TODO: List prerequisites and provide or point to information on how to start using the package.

Usage

The minimum required input is a BuildContext and a cookie policy url:

showCookieConsent(
  context,
  cookiePolicyUrl: Uri.parse('https://example.com/cookies'),
);
There are several layouts to choose from CookieConsentLayout
cupertinoBottomSheet
cupertinoAlert
floatingBottomSheet
cupertinoAlert
materialAlert
materialBottomSheet
materialSnackBar
showCookieConsent(
  context,
  layout: CookieConsentLayout.materialSnackBar,
  cookiePolicyUrl: Uri.parse('https://example.com/cookies'),
);

We recommend that you provide your own consent text and categories, tailored to your app:

showCookieConsent(
  context,
  cookiePolicyUrl: Uri.parse('https://example.com/cookies'),
  consent: 'By clicking [acceptallcookies], you agree that we can store cookies '
    'on your device and disclose information in accordance with our [cookiepolicy].',
  categories: [
    CookeConsentCategory(
      id: 'necessary',
      name: 'Strictly Necessary Cookies',
      description:
          'Necessary cookies are required to enable the basic features of this site, '
          'such as providing secure log-in or adjusting your consent preferences. '
          'These cookies do not store any personally identifiable data.',
    ),
    CookeConsentCategory(
      id: 'advertising',
      name: 'Advertising Cookies',
      description:
          'Advertising cookies are used to provide visitors with customized '
          'advertisements based on the pages you visited previously and to analyze '
          'the effectiveness of the ad campaigns.',
    ),
  ],
);

See example/ for a working app with demos of all layouts