import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'callbacks.dart';

class TitleWithAddButton extends StatelessWidget {
  final IconData iconData;
  final String titleKey;
  final OnTap onTap;

  const TitleWithAddButton({Key key, this.iconData, this.titleKey, this.onTap})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Row(
          children: [
            Padding(
              padding: const EdgeInsets.only(right: 15.0),
              child: Icon(
                this.iconData,
                color: primaryColor,
              ),
            ),
            LocalText(
              context,
              titleKey,
              color: Colors.black54,
              fontSize: 20,
            )
          ],
        ),
        Spacer(),
        onTap == null
            ? Container()
            : Padding(
                padding: const EdgeInsets.only(right: 0),
                child: IconButton(
                    onPressed: () => onTap(),
                    icon: Icon(
                      Icons.add_circle,
                      color: primaryColor,
                    )),
              )
      ],
    );
  }
}
