import 'package:enaklo_pos/core/components/components.dart';
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
import 'package:flutter/material.dart';

class ConfirmPaymentTitle extends StatelessWidget {
  final String title;
  final String? subtitle;
  final bool isBack;
  final List<Widget>? actionWidget;
  const ConfirmPaymentTitle({
    super.key,
    required this.title,
    this.subtitle,
    this.isBack = true,
    this.actionWidget,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      height: context.deviceHeight * 0.123,
      padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
      decoration: BoxDecoration(
        color: AppColors.white,
        border: Border(
          bottom: BorderSide(
            color: AppColors.grey,
            width: 1.0,
          ),
        ),
      ),
      child: Row(
        children: [
          if (isBack) ...[
            GestureDetector(
              onTap: () => context.pop(),
              child: Icon(
                Icons.arrow_back,
                color: AppColors.primary,
                size: 24,
              ),
            ),
            SpaceWidth(16),
          ],
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  title,
                  style: TextStyle(
                    color: AppColors.black,
                    fontSize: 20,
                    fontWeight: FontWeight.w600,
                  ),
                ),
                if (subtitle != null) ...[
                  const SizedBox(height: 4.0),
                  Text(
                    subtitle!,
                    style:
                        const TextStyle(fontSize: 14.0, color: AppColors.grey),
                  ),
                ]
              ],
            ),
          ),
          if (actionWidget != null) ...actionWidget!,
        ],
      ),
    );
  }
}
