import 'package:flutter/material.dart';
import 'package:satu/shared/app_colors.dart';

class JournalTile extends StatelessWidget {
  const JournalTile({
    required this.title,
    required this.subTitle,
    this.received = true,
    this.amount = 0,
    this.date = '01.01.2000',
    Key? key,

    this.onPress,
  }) : super(key: key);

  final String title;
  final String subTitle;
  final bool received;
  final double amount;
  final String date;
  final Function()? onPress;

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: const BoxDecoration(color: whiteColor),
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          onTap: onPress,
          child: Padding(
            padding:
                const EdgeInsets.symmetric(horizontal: 15.0, vertical: 10.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      title,
                      style: const TextStyle(fontSize: 12, color: textColor),
                    ),
                    Text(
                        subTitle,
                        style: const TextStyle(
                            fontSize: 10, color: placeholderColor)),
                  ],
                ),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.end,
                  children: [
                    Text(
                       ' ${received ? '+' : '-'} $amount ₸',
                      style: TextStyle(
                        color: received ? Colors.green : Colors.red,
                        fontSize: 14,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    Text(
                        date,
                        style: const TextStyle(
                            fontSize: 10, color: placeholderColor)),
                  ],
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
