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/string_extensions.dart';
import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:provider/provider.dart';

class MarathonHeader extends StatelessWidget {
  const MarathonHeader({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Container(
        color: MyColors.kWhiteColor,
        width: double.infinity,
        height: 65,
        padding: const EdgeInsets.symmetric(horizontal: 25, vertical: 15),
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.end,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            LocaleKeys.brainMarathon.tr().toText24(isBold: true),
            IconButton(
              padding: EdgeInsets.zero,
              icon: const Icon(Icons.close, size: 28),
              color: MyColors.black,
              constraints: const BoxConstraints(),
              onPressed: () {
                Provider.of<MarathonProvider>(context, listen: false)
                    .resetValues();
                Navigator.pop(context);
              },
            )
          ],
        ),
      ),
    );
  }
}
