import 'package:cargocalculaterapp/core/extension/build_context_extension.dart';
import 'package:cargocalculaterapp/core/utils/app_utils.dart';
import 'package:flutter/material.dart';

class StatusItemWidget extends StatelessWidget {
  final bool showConnector;
  final bool isCompleted;
  final bool dividerCompleted;
  final String title;
  final String number;

  const StatusItemWidget({
    super.key,

    this.showConnector = true,
    this.dividerCompleted = false,
    required this.isCompleted,
    required this.title,
    required this.number,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      mainAxisAlignment: MainAxisAlignment.start,
      children: [
        Row(
          children: [
            Container(
              margin: const EdgeInsets.only(top: 4, bottom: 4, right: 12),
              width: 32,
              height: 32,
              decoration: BoxDecoration(
                color:
                    isCompleted
                        ? context.color.primaryColor
                        : context.color.statusIconBackground,
                border: Border.all(color: context.color.primaryColor),
                borderRadius: AppUtils.kBorderRadius48,
              ),
              padding: AppUtils.kPaddingAll6,
              child:
                  isCompleted
                      ? const Center(
                        child: Icon(
                          Icons.check_rounded,
                          color: Colors.white,
                          size: 16,
                        ),
                      )
                      : Center(
                        child: Text(number, style: context.text.statusNumber),
                      ),
            ),
            Text(
              title,
              textAlign: TextAlign.start,
              style: context.text.statusDesc,
            ),
          ],
        ),
        if (showConnector)
          Container(
            margin: const EdgeInsets.only(left: 15),
            height: 16,
            width: 2,
            color: context.color.primaryColor,
          ),
      ],
    );
  }
}
