md-app/lib/pages/detail_conference.dart

72 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:lgcc/models/conferences_model.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:intl/intl.dart';
class DetailConference extends StatelessWidget {
final ConferencesModel conference;
const DetailConference({super.key, required this.conference});
@override
Widget build(BuildContext context) {
// Check if the conference has a thumbnail, if not use a default image
String urlImage;
if (conference.thumbnail.isEmpty) {
urlImage =
'https://ik.imagekit.io/lgccc/tr:w-1920,f-auto/youtube_thumbnail_46396.png';
} else {
urlImage =
'https://directus.carpa.com/assets/${conference.thumbnail}?access_token=${dotenv.env['DIRECTUS_API_TOKEN']}';
}
final formattedDate = DateFormat.yMMMMEEEEd().format(conference.date);
return Scaffold(
appBar: AppBar(
title: const Text('Conferencias'),
centerTitle: true,
backgroundColor: Color(0xFFE5EBFD),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.network(urlImage),
const SizedBox(height: 8),
Text(
conference.title,
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
height: 1.2,
),
),
Text(
formattedDate,
style: const TextStyle(fontSize: 16, color: Colors.black),
),
Text(
'${conference.place}, ${conference.city}, ${conference.state}, ${conference.country}',
style: const TextStyle(fontSize: 16, color: Colors.black),
),
Text(
'Actividad: ${conference.activity}',
style: const TextStyle(fontSize: 16, color: Colors.black),
),
],
),
],
),
),
),
);
}
}