Widgets CurrencyCard.dart

반응형
import 'package:flutter/material.dart';

class CurrencyCard extends StatelessWidget {

  final String name, code, amount;
  final IconData icon;
  final bool isInverted;

  final _blackColor = const Color(0xFF1F2123);

  const CurrencyCard({
    super.key,
    required this.name,
    required this.code,
    required this.amount,
    required this.icon,
    required this.isInverted,

  });

  @override
  Widget build(BuildContext context) {
    return Container(
      clipBehavior: Clip.hardEdge,
      decoration: BoxDecoration(
        color: isInverted ? Colors.white :
        _blackColor,
        borderRadius: BorderRadius.circular(25),
      ),
      child: Padding(
        padding: const EdgeInsets.all(20),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(
                  name,
                  style: TextStyle(
                    color: isInverted ? _blackColor: Colors.white,
                    fontSize: 32,
                    fontWeight: FontWeight.
                    w600,
                  ),
                ),
                const SizedBox(
                  height: 30,
                ),
                Row(
                  children: [
                    Text(
                      amount,
                      style: TextStyle(
                        color: isInverted ? _blackColor: Colors.white,
                        fontSize: 20,
                      ),
                    ),
                    SizedBox(width: 5,
                    ),
                    Text(
                      code,
                      style: TextStyle(
                        color: isInverted ? _blackColor: Colors.
                        white.withOpacity(0.8),
                        fontSize: 20,
                      ),

                    ),],
                ),
              ],
            ),
            Transform.scale(
              scale: 1.5,
              child: Transform.translate(
                offset: const Offset(
                  -5,
                  20,
                ),
                child: Icon(
                  icon,
                  color: isInverted ? _blackColor: Colors.
                  white,
                  size: 88,
                ),
              ),
            ),

          ],
        ),
      ),
    );
  }
}
반응형