Flutter Cookie Consent Privacy Banner

A privacy and cookie consent banner for web and mobile: an icon header, a plain-language explanation, an always-on essentials note, and a clear action hierarchy of accept, customize, and reject. A reusable compliance pattern composed from Wind className strings with dark-mode pairs.

Anılcan Çakır by Anılcan Çakır 6 views 0 stars 3 days ago Rev 1
Flutter Cookie Consent Privacy Banner preview
main.dart
WDiv(
  className: 'flex flex-col gap-4 w-full max-w-sm p-6 rounded-3xl bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 shadow-xl',
  children: [
    WDiv(
      className: 'flex flex-row items-center gap-3 w-full',
      children: [
        WDiv(
          className: 'flex flex-row items-center justify-center w-11 h-11 rounded-2xl bg-amber-100 dark:bg-amber-500/15',
          child: WIcon(
            Icons.info,
            className: 'text-xl text-amber-600 dark:text-amber-400'
          ),
        ),
        WText(
          'We value your privacy',
          className: 'text-lg font-bold text-gray-900 dark:text-white'
        ),
      ],
    ),
    WText(
      'We use cookies to improve your experience, analyze traffic, and personalize content. You can accept all or choose what to allow.',
      className: 'text-sm leading-relaxed text-gray-500 dark:text-gray-400',
    ),
    WDiv(
      className: 'flex flex-row items-center gap-2 px-3 py-2 rounded-xl bg-gray-50 dark:bg-gray-800',
      children: [
        WIcon(
          Icons.check,
          className: 'text-sm text-emerald-500 dark:text-emerald-400'
        ),
        WText(
          'Essential cookies are always on',
          className: 'text-xs text-gray-500 dark:text-gray-400'
        ),
      ],
    ),
    WButton(
      className: 'flex flex-row items-center justify-center w-full py-3 rounded-xl bg-indigo-600 dark:bg-indigo-500 shadow-lg',
      child: WText(
        'Accept all',
        className: 'text-sm font-semibold text-white dark:text-white'
      ),
    ),
    WButton(
      className: 'flex flex-row items-center justify-center w-full py-3 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800',
      child: WText(
        'Customize settings',
        className: 'text-sm font-semibold text-gray-700 dark:text-gray-200'
      ),
    ),
    WDiv(
      className: 'flex flex-row items-center justify-center w-full',
      child: WText(
        'Reject all non-essential',
        className: 'text-xs font-semibold text-gray-400 dark:text-gray-500'
      ),
    ),
  ],
)
Stats
Views
6
Stars
0
Revisions
1
Size
2,125 chars
Created
Jun 21, 2026