import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/config/routes.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_intro_screen.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:mohem_flutter_app/ui/marathon/widgets/countdown_timer.dart';
import 'package:provider/provider.dart';

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

  @override
  Widget build(BuildContext context) {
    MarathonProvider provider = context.read<MarathonProvider>();
    return Container(
      decoration: MyDecorations.shadowDecoration,
      child: Stack(
        children: [
          SvgPicture.asset(
            "assets/images/marathon_banner_bg.svg",
            fit: BoxFit.cover,
            width: MediaQuery.of(context).size.width - 40,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.end,
            children: <Widget>[
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  5.height,
                  Flexible(
                    child: const Text(
                      "Get Ready for the coming contest:",
                      style: TextStyle(
                        fontStyle: FontStyle.italic,
                        fontSize: 12,
                        fontWeight: FontWeight.w600,
                        color: MyColors.lightGreyEFColor,
                        letterSpacing: -0.4,
                      ),
                    ).paddingOnly(right: 12),
                  ),
                  const Flexible(
                    child: Text(
                      "Saudi Arabia",
                      style: TextStyle(
                        fontStyle: FontStyle.italic,
                        fontSize: 21,
                        fontWeight: FontWeight.bold,
                        color: MyColors.lightGreyEFColor,
                        // letterSpacing: -0.4,
                      ),
                    ),
                  ),
                  3.height,
                  BuildCountdownTimer(
                    timeToMarathon: dummyEndTime,
                    provider: provider,
                    screenFlag: 0,
                  ),
                ],
              )
            ],
          ).paddingOnly(right: 10),
        ],
      ).onPress(
        () => Navigator.pushNamed(context, AppRoutes.marathonIntroScreen),
      ),
    );
  }
}
