You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			125 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			125 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			Dart
		
	
| import 'package:easy_localization/easy_localization.dart';
 | |
| import 'package:flutter/material.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/models/marathon/marathon_model.dart';
 | |
| import 'package:mohem_flutter_app/ui/marathon/marathon_provider.dart';
 | |
| import 'package:provider/provider.dart';
 | |
| 
 | |
| class MarathonDetailsCard extends StatelessWidget {
 | |
|   final MarathonDetailModel marathonDetailModel;
 | |
| 
 | |
|   const MarathonDetailsCard({Key? key, required this.marathonDetailModel}) : super(key: key);
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     return Container(
 | |
|       width: double.infinity,
 | |
|       decoration: MyDecorations.shadowDecoration,
 | |
|       padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 14),
 | |
|       child: Column(
 | |
|         crossAxisAlignment: CrossAxisAlignment.start,
 | |
|         children: <Widget>[
 | |
|           context.read<MarathonProvider>().isUpComingMarathon
 | |
|               ? const SizedBox()
 | |
|               : Row(
 | |
|                   mainAxisAlignment: MainAxisAlignment.end,
 | |
|                   children: [
 | |
|                     Container(
 | |
|                       decoration: BoxDecoration(color: MyColors.yellowColorII, borderRadius: BorderRadius.circular(100)),
 | |
|                       child: LocaleKeys.demo.tr().toText10(color: MyColors.white).paddingAll(4),
 | |
|                     ),
 | |
|                   ],
 | |
|                 ),
 | |
|           7.height,
 | |
|           LocaleKeys.contestTopicAbout.tr().toText16(color: MyColors.grey77Color),
 | |
|           displayLocalizedContent(
 | |
|             isPhoneLangArabic: AppState().isArabic(context),
 | |
|             selectedLanguage: marathonDetailModel.selectedLanguage ?? 0,
 | |
|             englishContent: marathonDetailModel.titleEn ?? "",
 | |
|             arabicContent: marathonDetailModel.titleAr ?? "",
 | |
|           ).toText20(color: MyColors.textMixColor, isBold: true),
 | |
|           Row(
 | |
|             children: <Widget>[
 | |
|               Flexible(
 | |
|                 child: displayLocalizedContent(
 | |
|                   isPhoneLangArabic: AppState().isArabic(context),
 | |
|                   selectedLanguage: marathonDetailModel.selectedLanguage ?? 0,
 | |
|                   englishContent: marathonDetailModel.descEn ?? "",
 | |
|                   arabicContent: marathonDetailModel.descAr ?? "",
 | |
|                 ).toText14(
 | |
|                   color: MyColors.grey77Color,
 | |
|                 ),
 | |
|               )
 | |
|             ],
 | |
|           ),
 | |
|           if (marathonDetailModel.sponsors != null && marathonDetailModel.sponsors!.isNotEmpty) ...<Widget>[
 | |
|             5.height,
 | |
|             marathonDetailModel.sponsors!.first.sponsorPrizes != null
 | |
|                 ? Row(
 | |
|                     children: <Widget>[
 | |
|                       "${LocaleKeys.prize.tr()} ".toText16(color: MyColors.grey77Color, isBold: true),
 | |
|                       Expanded(
 | |
|                         child: SizedBox(
 | |
|                           height: 30,
 | |
|                           child: ListView.builder(
 | |
|                             scrollDirection: Axis.horizontal,
 | |
|                             shrinkWrap: true,
 | |
|                             itemCount: marathonDetailModel.sponsors!.first.sponsorPrizes!.length,
 | |
|                             itemBuilder: (BuildContext context, int index) {
 | |
|                               SponsorPrizes prizes = marathonDetailModel.sponsors!.first.sponsorPrizes![index];
 | |
|                               return Container(
 | |
|                                 decoration: BoxDecoration(color: MyColors.backgroundColor, borderRadius: BorderRadius.circular(100), border: Border.all(color: MyColors.grey57Color.withOpacity(0.1))),
 | |
|                                 child: displayLocalizedContent(
 | |
|                                   isPhoneLangArabic: AppState().isArabic(context),
 | |
|                                   selectedLanguage: marathonDetailModel.selectedLanguage ?? 0,
 | |
|                                   englishContent: prizes.marathonPrizeEn ?? "",
 | |
|                                   arabicContent: prizes.marathonPrizeAr ?? "",
 | |
|                                 ).toText16(color: MyColors.greenColor, isBold: true).paddingOnly(left: 5, right: 5),
 | |
|                               ).paddingOnly(left: 5);
 | |
|                             },
 | |
|                           ),
 | |
|                         ),
 | |
|                       )
 | |
|                     ],
 | |
|                   )
 | |
|                 : const SizedBox(),
 | |
|             Row(
 | |
|               children: <Widget>[
 | |
|                 "${LocaleKeys.sponsoredBy.tr()} ".toText16(color: MyColors.grey77Color),
 | |
|                 displayLocalizedContent(
 | |
|                   isPhoneLangArabic: AppState().isArabic(context),
 | |
|                   selectedLanguage: marathonDetailModel.selectedLanguage ?? 0,
 | |
|                   englishContent: marathonDetailModel.sponsors?.first.nameEn ?? "",
 | |
|                   arabicContent: marathonDetailModel.sponsors?.first.nameAr ?? "",
 | |
|                 ).toText16(color: MyColors.darkTextColor, isBold: true),
 | |
|               ],
 | |
|             ),
 | |
|             10.height,
 | |
|             Row(
 | |
|               mainAxisAlignment: MainAxisAlignment.center,
 | |
|               children: <Widget>[
 | |
|                 Image.network(
 | |
|                   ApiConsts.marathonBaseUrlServices + marathonDetailModel.sponsors!.first.logo!,
 | |
|                   height: 50,
 | |
|                   width: 150,
 | |
|                   fit: BoxFit.contain,
 | |
|                   errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
 | |
|                     return Image.asset("assets/images/logos/main_mohemm_logo.png", height: 50, width: 150);
 | |
|                   },
 | |
|                 )
 | |
|               ],
 | |
|             ),
 | |
|           ]
 | |
|         ],
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 |