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.
123 lines
5.8 KiB
Dart
123 lines
5.8 KiB
Dart
|
1 year ago
|
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/disclosure/disclosure_details_model.dart';
|
||
|
|
import 'package:mohem_flutter_app/ui/disclosure/disclosure_provider.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
|
||
|
|
class DisclosureDetailsCard extends StatelessWidget {
|
||
|
|
final DisclosureDetailsModel disclosureDetailsCard;
|
||
|
|
|
||
|
|
const DisclosureDetailsCard({Key? key, required this.disclosureDetailsCard}) : 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>[
|
||
|
|
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: disclosureDetailsCard.selectedLanguage ?? 0,
|
||
|
|
englishContent: disclosureDetailsCard.titleEn ?? "",
|
||
|
|
arabicContent: disclosureDetailsCard.titleAr ?? "",
|
||
|
|
).toText20(color: MyColors.textMixColor, isBold: true),
|
||
|
|
Row(
|
||
|
|
children: <Widget>[
|
||
|
|
Flexible(
|
||
|
|
child: displayLocalizedContent(
|
||
|
|
isPhoneLangArabic: AppState().isArabic(context),
|
||
|
|
selectedLanguage: disclosureDetailsCard.selectedLanguage ?? 0,
|
||
|
|
englishContent: disclosureDetailsCard.descEn ?? "",
|
||
|
|
arabicContent: disclosureDetailsCard.descAr ?? "",
|
||
|
|
).toText14(
|
||
|
|
color: MyColors.grey77Color,
|
||
|
|
),
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
if (disclosureDetailsCard.sponsors != null && disclosureDetailsCard.sponsors!.isNotEmpty) ...<Widget>[
|
||
|
|
5.height,
|
||
|
|
disclosureDetailsCard.sponsors!.first.sponsorPrizes != null
|
||
|
|
? Row(
|
||
|
|
children: <Widget>[
|
||
|
|
"${LocaleKeys.prize.tr()} ".toText16(color: MyColors.grey77Color),
|
||
|
|
Expanded(
|
||
|
|
child: SizedBox(
|
||
|
|
height: 30,
|
||
|
|
child: ListView.builder(
|
||
|
|
scrollDirection: Axis.horizontal,
|
||
|
|
shrinkWrap: true,
|
||
|
|
itemCount: disclosureDetailsCard.sponsors!.first.sponsorPrizes!.length,
|
||
|
|
itemBuilder: (BuildContext context, int index) {
|
||
|
|
SponsorPrizes prizes = disclosureDetailsCard.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: disclosureDetailsCard.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: disclosureDetailsCard.selectedLanguage ?? 0,
|
||
|
|
englishContent: disclosureDetailsCard.sponsors?.first.nameEn ?? "",
|
||
|
|
arabicContent: disclosureDetailsCard.sponsors?.first.nameAr ?? "",
|
||
|
|
).toText16(color: MyColors.darkTextColor, isBold: true),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
10.height,
|
||
|
|
Row(
|
||
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
|
children: <Widget>[
|
||
|
|
Image.network(
|
||
|
|
ApiConsts.marathonBaseUrlServices + disclosureDetailsCard.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);
|
||
|
|
},
|
||
|
|
)
|
||
|
|
],
|
||
|
|
),
|
||
|
|
]
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|