124 lines
3.5 KiB
Dart
124 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:em2rp/models/event_model.dart';
|
|
import 'package:em2rp/utils/colors.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class EventDetails extends StatelessWidget {
|
|
final EventModel event;
|
|
|
|
const EventDetails({
|
|
Key? key,
|
|
required this.event,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final dateFormat = DateFormat('dd/MM/yyyy HH:mm');
|
|
final currencyFormat = NumberFormat.currency(locale: 'fr_FR', symbol: '€');
|
|
|
|
return Card(
|
|
margin: const EdgeInsets.all(16),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
event.name,
|
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
|
color: AppColors.noir,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
_buildInfoRow(
|
|
context,
|
|
Icons.calendar_today,
|
|
'Date de début',
|
|
dateFormat.format(event.startDateTime),
|
|
),
|
|
_buildInfoRow(
|
|
context,
|
|
Icons.calendar_today,
|
|
'Date de fin',
|
|
dateFormat.format(event.endDateTime),
|
|
),
|
|
_buildInfoRow(
|
|
context,
|
|
Icons.euro,
|
|
'Prix',
|
|
currencyFormat.format(event.price),
|
|
),
|
|
_buildInfoRow(
|
|
context,
|
|
Icons.build,
|
|
'Temps d\'installation',
|
|
'${event.installationTime} heures',
|
|
),
|
|
_buildInfoRow(
|
|
context,
|
|
Icons.construction,
|
|
'Temps de démontage',
|
|
'${event.disassemblyTime} heures',
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Description',
|
|
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
|
color: AppColors.noir,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
event.description,
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Adresse',
|
|
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
|
color: AppColors.noir,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'${event.address.latitude}° N, ${event.address.longitude}° E',
|
|
style: Theme.of(context).textTheme.bodyLarge,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildInfoRow(
|
|
BuildContext context,
|
|
IconData icon,
|
|
String label,
|
|
String value,
|
|
) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, color: AppColors.rouge),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'$label : ',
|
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
|
color: AppColors.noir,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Text(
|
|
value,
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|