import 'package:flutter/material.dart';

import '../../../../widget/centered_leading.dart';
import '../../../../widget/confirm_dialog.dart';
import '../../../../widget/details_bottom_sheet.dart';

class PrivacyInfo {
  String providerText;
  String privacyUrl;
  String imprintUrl;

  PrivacyInfo({
    required this.providerText,
    required this.imprintUrl,
    required this.privacyUrl,
  });

  void showPopup(BuildContext context) {
    showDetailsBottomSheet(
      context,
      header: Padding(
        padding: const EdgeInsets.fromLTRB(16, 4, 16, 12),
        child: Text(
          'Betreiberinformation | $providerText',
          style: Theme.of(context).textTheme.titleLarge,
        ),
      ),
      children: (sheetCtx) => [
        ListTile(
          leading: const CenteredLeading(Icon(Icons.person_pin_outlined)),
          title: const Text('Impressum'),
          subtitle: Text(imprintUrl),
          onTap: () => ConfirmDialog.openBrowser(sheetCtx, imprintUrl),
        ),
        ListTile(
          leading: const CenteredLeading(Icon(Icons.privacy_tip_outlined)),
          title: const Text('Datenschutzerklärung'),
          subtitle: Text(privacyUrl),
          onTap: () => ConfirmDialog.openBrowser(sheetCtx, privacyUrl),
        ),
      ],
    );
  }
}
