Untitled

mail@pastecode.io avatar
unknown
dart
2 months ago
7.7 kB
2
Indexable
Never
import 'package:centro/app/modules/Minister/Meeting/models/minister_meeting.dart';
import 'package:centro/app/services/authentication/auth_manager.dart';
import 'package:centro/app/services/translation_service.dart';
import 'package:centro/app/utilities/constants/app_colors.dart';
import 'package:centro/app/utilities/ui/app_extensions.dart';
import 'package:centro/app/utilities/ui/widgets/main_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';

class MeetingCard extends StatelessWidget {
  final Function() onTap;
  final MinisterMeetings model;
  final String color;

  const MeetingCard({
    super.key,
    required this.onTap,
    required this.model,
    required this.color,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        margin: const EdgeInsets.only(left: 24, right: 24),
        width: Get.width,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(15),
          color: color.toColor().withOpacity(0.2),
          image: const DecorationImage(
            fit: BoxFit.cover,
            image: AssetImage('assets/images/decorationsquares.png'),
          ),
        ),
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Row(
                    children: [
                      const CircleAvatar(
                        backgroundColor: AppColors.blue,
                        radius: 4,
                      ),
                      const SizedBox(
                        width: 6,
                      ),
                      Text(
                        appTools.getEventType(
                          2,
                          TranslationService().isLocaleArabic()
                              ? model.meetingTypeInfo?.name ?? ''
                              : model.meetingTypeInfo?.nameEn ?? '',
                        ),
                        style: textTheme.headline3?.copyWith(
                          color: AppColors.blue,
                          fontSize: 12,
                        ),
                      ),
                    ],
                  ),
                  if (model.priorityTypeId == 3)
                    Row(
                      children: [
                        CircleAvatar(
                          backgroundColor: model.priorityTypeId == 1
                              ? AppColors.primaryDark
                              : model.priorityTypeId == 2
                                  ? AppColors.yellow
                                  : AppColors.red,
                          radius: 4,
                        ),
                        const SizedBox(
                          width: 4,
                        ),
                        Text(
                          'Immediately'.tr,
                          style: textTheme.headline6?.copyWith(
                            color: model.priorityTypeId == 1
                                ? AppColors.primaryDark
                                : model.priorityTypeId == 2
                                    ? AppColors.yellow
                                    : AppColors.red,
                            fontWeight: FontWeight.bold,
                            fontSize: 12,
                          ),
                        ),
                      ],
                    ),
                ],
              ),
              SizedBox(
                height: Get.height * 0.02,
              ),
              Text(
                model.title ?? '',
                style: textTheme.headline5?.copyWith(color: AppColors.denim, fontSize: 16),
              ),
              SizedBox(
                height: Get.height * 0.02,
              ),
              Text(
                model.description ?? '',
                style: textTheme.headline6?.copyWith(color: AppColors.grey, fontSize: 11),
              ),
              SizedBox(
                height: Get.height * 0.02,
              ),
              const Divider(
                color: AppColors.white,
                thickness: 1,
              ),
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  model.startDate == null
                      ? const SizedBox()
                      : Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                SvgPicture.asset(
                                  'assets/icons/calendar_committee.svg',
                                  color: AppColors.primary,
                                  width: 20,
                                ),
                                const SizedBox(
                                  width: 8,
                                ),
                                MainText(
                                  text: '${model.startDate?.split('T').first}',
                                  color: AppColors.denim,
                                  fontSize: 13,
                                ),
                              ],
                            ),
                            MainText(
                              text:
                                  '${model.startDate?.split('T').last.substring(0, 5)} - ${model.endDate?.split('T').last.substring(0, 5)}',
                              color: AppColors.denim,
                              fontSize: 13,
                            )
                          ],
                        ),
                  model.meetingDocuments?.isNotEmpty ?? false
                      ? Column(
                          children: [
                            const SizedBox(
                              height: 8,
                            ),
                            Row(
                              children: [
                                Padding(
                                  padding: const EdgeInsets.only(left: 8.0),
                                  child: SvgPicture.asset(
                                    'assets/icons/folders.svg',
                                    color: AppColors.disabledColor,
                                  ),
                                ),
                                Text.rich(
                                  TextSpan(
                                    text: 'there are'.tr,
                                    children: [
                                      TextSpan(
                                        text: ' ${model.meetingDocuments?.length} ${'files attached'.tr}',
                                        style: textTheme.caption?.copyWith(color: AppColors.disabledColor),
                                      ),
                                    ],
                                    style: textTheme.caption?.copyWith(color: AppColors.disabledColor),
                                  ),
                                ),
                              ],
                            ),
                          ],
                        )
                      : const SizedBox(),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Leave a Comment