import 'package:cached_network_image/cached_network_image.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/app_state/app_state.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/classes/consts.dart';
import 'package:mohem_flutter_app/classes/decorations_helper.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.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/main.dart';
import 'package:mohem_flutter_app/models/marathon/marathon_model.dart';
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
import 'package:provider/provider.dart';
import 'package:shimmer/shimmer.dart';

class ActivityEventDetailsCard extends StatelessWidget {
  final DashboardProviderModel model;

  const ActivityEventDetailsCard({Key? key, required this.model}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
      Container(
      width: double.infinity,
      decoration: MyDecorations.shadowDecoration,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          CachedNetworkImage(
            imageUrl: model.eventActivity!.detailImageURL!,
            height: 200,
            placeholder: (BuildContext context, String url) =>  const LinearProgressIndicator(
              value: 0.7,
               minHeight: 200,

              valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
              backgroundColor: Color(0xff196D73),
            ).toShimmer(),
            fit: BoxFit.contain,width: double.infinity ,
            cacheKey: UniqueKey().toString(),
          ),

        ],
      ),
    ),
      Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          const SizedBox(height: 20,),
          Text(
            displayLocalizedContent(
              isPhoneLangArabic: AppState().isArabic(context),
              selectedLanguage: 3,
              englishContent: model.eventActivity?.titleEn ?? "",
              arabicContent: model.eventActivity?.titleAr ?? "",
            ),
            style: TextStyle(
              fontStyle: FontStyle.italic,
              fontSize: isTablet ? 30 : 20,
              fontWeight: FontWeight.bold,
              color:const Color(0xff3C3838),
              // height: 42 / 30,
            ),

          ).paddingOnly(left: 10, right: 10, bottom: 2),

        Row(children:[
          SvgPicture.asset("assets/images/highlight.svg"),
        Text(
            displayLocalizedContent(
              isPhoneLangArabic: AppState().isArabic(context),
              selectedLanguage: 3,
              englishContent: model.eventActivity?.shortDescEn ?? "",
              arabicContent: model.eventActivity?.shortDescAr ?? "",
            ),
            style: TextStyle(
              fontStyle: FontStyle.italic,
              fontSize: isTablet ? 20 : 14,
              fontWeight: FontWeight.bold,
              color:const Color(0xff2BB8A8),
              // height: 32 / 24,
            ),

          ).paddingOnly(left: 10, right: 10)
    ]).paddingOnly(bottom: 25),

          LocaleKeys.about.tr().toText16(color: const Color(0xff3C3838)).paddingOnly(bottom: 5),
          Text(
            displayLocalizedContent(
              isPhoneLangArabic: AppState().isArabic(context),
              selectedLanguage: 3,
              englishContent: model.eventActivity?.longDescEn ?? "",
              arabicContent: model.eventActivity?.longDescAr ?? "",
            ),
            style: TextStyle(
              fontStyle: FontStyle.italic,
              fontSize: isTablet ? 18 : 12,
              fontWeight: FontWeight.bold,
              color:const Color(0xff3C3838),
              // height: 32 / 24,
            ),

          ).paddingOnly(bottom: 10)
        ],
      )
    ]);
  }
}
