import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:meltypay/constants/constants.dart';
import 'package:meltypay/models/models.dart';
import 'package:meltypay/widgets/widgets.dart';

class MyUserSelected extends StatelessWidget {
  final User user;
  const MyUserSelected({Key? key, required this.user}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 110,
      width: double.infinity,
      padding: const EdgeInsets.symmetric(horizontal: kDefaultpadding),
      decoration: BoxDecoration(
        color: kPrimaryColor,
        borderRadius: BorderRadius.circular(kDefaultBorderRadius),
      ),
      child: Row(children: [
        CircleAvatar(
          radius: 30 + 2,
          backgroundColor: Colors.white,
          child: getProfileImage(
            user: user,
            radius: 30,
          ),
        ),
        const SizedBox(width: kDefaultpadding),
        Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            if (user.firstName != null)
              Text(
                user.firstName! + "  " + user.lastName!,
                style: Theme.of(context)
                    .textTheme
                    .headline3!
                    .copyWith(color: Colors.white),
              ),
            if (user.firstName != null)
              const SizedBox(height: kDefaultpadding / 2),
            Text(
              user.tel,
              style: Theme.of(context)
                  .textTheme
                  .headline3!
                  .copyWith(color: Colors.white),
            ),
          ],
        ),
        const Spacer(),
        IconButton(
          iconSize: 33,
          onPressed: () {},
          icon: const FaIcon(
            FontAwesomeIcons.penToSquare,
            color: Colors.white,
          ),
        ),
      ]),
    );
  }
}
