import 'package:flutter/material.dart';

import '../theme/kc_spacing.dart';

/// A reusable section header used across app pages.
///
/// Displays a [title] with an optional trailing [action] widget
/// (e.g. a "View all" button).
class KcSectionHeader extends StatelessWidget {
  final String title;
  final Widget? action;

  const KcSectionHeader({super.key, required this.title, this.action});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(bottom: KcSpacing.sm),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(title, style: Theme.of(context).textTheme.titleLarge),
          ?action,
        ],
      ),
    );
  }
}
