import 'package:flutter/material.dart';

class PageHeader extends StatelessWidget {
  final Widget? leading;
  final Widget? trailing;
  final double height;

  const PageHeader({super.key, this.leading, this.trailing, this.height = 64});

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      height: height,
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 20),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            leading ?? const SizedBox.shrink(),
            trailing ?? const SizedBox.shrink(),
          ],
        ),
      ),
    );
  }
}

class BackButton extends StatelessWidget {
  final VoidCallback? onPressed;

  const BackButton({super.key, this.onPressed});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onPressed ?? () => Navigator.of(context).pop(),
      child: Container(
        width: 36,
        height: 36,
        decoration: BoxDecoration(
          color: const Color(0xFFF8FAFF),
          borderRadius: BorderRadius.circular(18),
          border: Border.all(color: const Color(0xFFDEE7F6)),
        ),
        child: const Icon(
          Icons.chevron_left,
          size: 18,
          color: Color(0xFF334155),
        ),
      ),
    );
  }
}
