import 'package:flutter/material.dart';
import 'package:qr_flutter/qr_flutter.dart';

class AppSharePlatformView extends StatelessWidget {
  final String title;
  final String url;
  const AppSharePlatformView(this.title, this.url, {super.key});

  @override
  Widget build(BuildContext context) {
    var foregroundColor = Theme.of(context).colorScheme.onSurface;
    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.center,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Text(
          title,
          style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
        ),
        const SizedBox(height: 30),
        Container(
          padding: const EdgeInsets.all(10),
          decoration: BoxDecoration(
            border: Border.all(color: foregroundColor, width: 10),
          ),
          child: QrImageView(
            data: url,
            version: QrVersions.auto,
            size: 200,
            dataModuleStyle: QrDataModuleStyle(
              color: foregroundColor,
              dataModuleShape: QrDataModuleShape.square,
            ),
            eyeStyle: QrEyeStyle(
              color: foregroundColor,
              eyeShape: QrEyeShape.square,
            ),
          ),
        ),
      ],
    );
  }
}
