import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/model/language_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';

typedef BtnCallback();

/// TaskButton is used to navigate to eash task
class TaskButton extends StatelessWidget {
  final String titleKey;
  final IconData icon;
  final BtnCallback btnCallback;

  const TaskButton(this.titleKey, {Key key, this.icon, this.btnCallback})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    var languageModel = Provider.of<LanguageModel>(context);
    return InkWell(
      onTap: btnCallback != null ? btnCallback : () => {},
      child: Container(
        width: 120,
        height: 155,
        padding: EdgeInsets.only(top: 0.0, left: 5, right: 5),
        decoration: new BoxDecoration(
            color: Colors.transparent,
            borderRadius: new BorderRadius.only(
                topLeft: const Radius.circular(40.0),
                topRight: const Radius.circular(40.0))),
        child: Padding(
          padding: const EdgeInsets.all(5.0),
          child: Column(children: <Widget>[
            ClipOval(
              child: Material(
                color: Colors.black54, // button color
                child: SizedBox(
                    width: 100,
                    height: 100,
                    child: Icon(icon, color: Colors.white, size: 50)),
              ),
            ),
            Container(
              height: 45,
              alignment: Alignment.topCenter,
              child: Text(AppTranslations.of(context).text(titleKey),
                  textAlign: TextAlign.center,
                  style: languageModel.isEng
                      ? TextStyle(
                          color: Colors.white,
                          fontWeight: FontWeight.w500,
                          fontSize: 15.0,
                          fontFamily: "Roboto")
                      : TextStyle(
                          color: Colors.white,
                          fontWeight: FontWeight.w500,
                          fontSize: 14.0,
                          fontFamily: "Myanmar3")),
            ),
          ]),
        ),
      ),
    );
  }
}
