import 'package:flutter/material.dart';

/// Cornice "ibrida": bordo esterno rettangolare + bordo interno smussato.
class HybridFrame extends StatelessWidget {
  final Widget child;

  /// raggio della cornice interna
  final double radius;

  /// spessore dei bordi
  final double stroke;

  /// distanza tra bordo esterno e interno
  final double inset;

  /// colori personalizzabili
  final Color? outerColor;
  final Color? innerColor;

  const HybridFrame({
    super.key,
    required this.child,
    this.radius = 12,
    this.stroke = 2,
    this.inset = 3,
    this.outerColor,
    this.innerColor,
  });

  @override
  Widget build(BuildContext context) {
    final oc = outerColor ?? Colors.white.withOpacity(.85);
    final ic = innerColor ?? Colors.black.withOpacity(.55);

    return Stack(
      fit: StackFit.expand,
      children: [
        child,

        // bordo esterno: rettangolare
        Positioned.fill(
          child: IgnorePointer(
            child: DecoratedBox(
              decoration: BoxDecoration(
                border: Border.all(color: oc, width: stroke),
              ),
            ),
          ),
        ),

        // bordo interno: smussato
        Positioned.fill(
          child: IgnorePointer(
            child: Padding(
              padding: EdgeInsets.all(inset),
              child: DecoratedBox(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(radius),
                  border: Border.all(color: ic, width: stroke),
                ),
              ),
            ),
          ),
        ),
      ],
    );
  }
}

