import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:mohem_flutter_app/widgets/button/default_button.dart';

class MarathonFooter extends StatelessWidget {
  final MarathonProvider provider;

  const MarathonFooter({
    Key? key,
    required this.provider,
  }) : super(key: key);

  Widget buildNoteForDemo() {
    return RichText(
      text: TextSpan(
        children: <InlineSpan>[
          TextSpan(
            text: LocaleKeys.note.tr(),
            style: const TextStyle(color: MyColors.darkTextColor, fontSize: 17, letterSpacing: -0.64, fontWeight: FontWeight.bold),
          ),
          TextSpan(
            text: " " + LocaleKeys.demoMarathonNoteP1.tr(),
            style: const TextStyle(color: MyColors.grey77Color, fontSize: 17, letterSpacing: -0.64, fontWeight: FontWeight.w500),
          ),
          TextSpan(
            text: " " + LocaleKeys.demoMarathonNoteP2.tr(),
            style: const TextStyle(color: MyColors.darkTextColor, fontSize: 17, fontWeight: FontWeight.bold),
          ),
          TextSpan(
            text: " " + LocaleKeys.demoMarathonNoteP3.tr(),
            style: const TextStyle(color: MyColors.grey77Color, fontSize: 17, letterSpacing: -0.64, fontWeight: FontWeight.w500),
          )
        ],
      ),
    ).paddingOnly(right: 21, left: 21, top: 11, bottom: 0);
  }

  @override
  Widget build(BuildContext context) {
    return DefaultButton(
      LocaleKeys.joinMarathon.tr(),
      !provider.itsMarathonTime ? () => provider.onJoinMarathonPressed(context) : null,
    ).insideContainer;
  }
}
