feat: Add full-screen receipt viewer, display trip participants in calendar, and restrict trip management options to creator.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:travel_mate/blocs/trip/trip_bloc.dart';
|
||||
@@ -589,50 +590,99 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (context) => Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(Icons.edit, color: theme.colorScheme.primary),
|
||||
title: Text(
|
||||
'Modifier le voyage',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
CreateTripContent(tripToEdit: widget.trip),
|
||||
builder: (context) {
|
||||
return BlocBuilder<UserBloc, user_state.UserState>(
|
||||
builder: (context, state) {
|
||||
final currentUser = state is user_state.UserLoaded
|
||||
? state.user
|
||||
: null;
|
||||
final isCreator = currentUser?.id == widget.trip.createdBy;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (isCreator) ...[
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.edit,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
title: Text(
|
||||
'Modifier le voyage',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
CreateTripContent(tripToEdit: widget.trip),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete, color: Colors.red),
|
||||
title: Text(
|
||||
'Supprimer le voyage',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_confirmDeleteTrip();
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
],
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
Icons.share,
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
title: Text(
|
||||
'Partager le code',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
// Implement share functionality
|
||||
if (_group != null) {
|
||||
// Use share_plus package to share the code
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('ID du groupe : ${_group!.id}'),
|
||||
action: SnackBarAction(
|
||||
label: 'Copier',
|
||||
onPressed: () {
|
||||
Clipboard.setData(
|
||||
ClipboardData(text: _group!.id),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete, color: Colors.red),
|
||||
title: Text(
|
||||
'Supprimer le voyage',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface,
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_showDeleteConfirmation();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showDeleteConfirmation() {
|
||||
void _confirmDeleteTrip() {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
showDialog(
|
||||
|
||||
Reference in New Issue
Block a user