'use client'
import React, { useState } from 'react'
import { SDKDocsSidebar } from '@/components/SDKDocsSidebar'
import { Copy, Check, Smartphone } from 'lucide-react'
function CopyButton({ text }: { text: string }) {
const [copied, setCopied] = useState(false)
const handleCopy = async () => {
await navigator.clipboard.writeText(text)
setCopied(true)
setTimeout(() => setCopied(false), 2000)
}
return (
)
}
function CodeBlock({ code, filename }: { code: string; filename?: string }) {
return (
{filename && (
{filename}
)}
)
}
export default function FlutterSDKPage() {
return (
Cross-Platform SDK fuer Flutter 3.16+ mit iOS, Android und Web Support.
{/* Requirements */}
Systemvoraussetzungen
| Dart Version |
3.0+ |
| Flutter Version |
3.16+ |
| Plattformen |
iOS, Android, Web |
{/* Installation */}
{/* Basic Setup */}
{/* Widget Usage */}
Widget Integration
(
stream: ConsentManager.instance.consentStream,
builder: (context, snapshot) {
final consent = snapshot.data;
if (consent?.hasConsent(ConsentCategory.analytics) ?? false) {
return const AnalyticsWidget();
}
return const SizedBox.shrink();
},
),
// ConsentGate Widget
ConsentGate(
category: ConsentCategory.marketing,
fallback: const Center(
child: Text('Marketing-Zustimmung erforderlich'),
),
child: const MarketingWidget(),
),
// Buttons
ElevatedButton(
onPressed: () => ConsentManager.instance.acceptAll(),
child: const Text('Alle akzeptieren'),
),
ElevatedButton(
onPressed: () => ConsentManager.instance.rejectAll(),
child: const Text('Alle ablehnen'),
),
TextButton(
onPressed: () => ConsentManager.instance.showSettings(context),
child: const Text('Einstellungen'),
),
],
),
);
}
}`}
/>
{/* Custom Banner */}
Custom Cookie Banner
(
stream: ConsentManager.instance.isBannerVisibleStream,
builder: (context, snapshot) {
if (!(snapshot.data ?? false)) {
return const SizedBox.shrink();
}
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 10,
),
],
),
child: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
'Wir verwenden Cookies um Ihr Erlebnis zu verbessern.',
style: TextStyle(fontSize: 14),
),
const SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => ConsentManager.instance.rejectAll(),
child: const Text('Ablehnen'),
),
TextButton(
onPressed: () => ConsentManager.instance.showSettings(context),
child: const Text('Einstellungen'),
),
ElevatedButton(
onPressed: () => ConsentManager.instance.acceptAll(),
child: const Text('Alle akzeptieren'),
),
],
),
],
),
),
);
},
);
}
}`}
/>
{/* API Reference */}
API Referenz
| Methode/Property |
Beschreibung |
initialize() |
SDK initialisieren (Future) |
hasConsent() |
Consent pruefen |
consentStream |
Stream fuer Consent-Updates |
isBannerVisibleStream |
Stream fuer Banner-Sichtbarkeit |
acceptAll() |
Alle akzeptieren (Future) |
rejectAll() |
Alle ablehnen (Future) |
setConsent() |
Kategorien setzen (Future) |
showSettings() |
Einstellungs-Dialog oeffnen |
)
}