import 'package:cims_apps/application/component/image/image_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:flutter/material.dart';

class CardTransactionView extends StatelessWidget {
  final VoidCallback onTap;
  final String iconPath, type, amount, subs, step;
  final String? timeTransaction;
  const CardTransactionView({
    Key? key,
    required this.step,
    required this.type,
    required this.amount,
    required this.iconPath,
    required this.subs,
    required this.onTap,
    this.timeTransaction,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    TextTheme textTheme = Theme.of(context).textTheme;
    return GestureDetector(
      onTap: onTap,
      child: Container(
        margin: const EdgeInsets.symmetric(vertical: 16.0),
        padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border.all(width: 1, color: ColorPalette.slate200),
          borderRadius: const BorderRadius.all(Radius.circular(12)),
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            SizedBox(
                width: SizeConfig.width * .4,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Row(
                      children: [
                        ImageView(
                            image: iconPath, width: SizeConfig.width * .12),
                        Padding(
                          padding: const EdgeInsets.only(left: 8.0),
                          child: Text(
                            type,
                            style: textTheme.headlineSmall,
                          ),
                        ),
                      ],
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 16.0),
                      child: Text(
                        amount,
                        style: textTheme.headlineSmall,
                      ),
                    ),
                  ],
                )),
            SizedBox(
                width: SizeConfig.width * .4,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.end,
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    SizedBox(
                        height: SizeConfig.height * .08,
                        child: Text(
                          subs,
                          style: const TextStyle(color: ColorPalette.primary),
                        )),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        step == 'waiting'
                            ? const Icon(Icons.access_time_sharp,
                                color: ColorPalette.slate400)
                            : const SizedBox(),
                        step == 'waiting'
                            ? Text(timeTransaction.toString())
                            : const SizedBox(),
                        const Padding(
                          padding: EdgeInsets.only(left: 16.0),
                          child: Icon(Icons.arrow_forward_ios),
                        ),
                      ],
                    ),
                  ],
                )),
          ],
        ),
      ),
    );
  }
}
