genericizing add card, activity ui tweaks

This commit is contained in:
Joshua Burman
2025-01-07 12:37:17 -05:00
parent 8ec531c0ea
commit 0b0ca884bc
7 changed files with 97 additions and 50 deletions

View File

@ -11,9 +11,11 @@ import 'package:sendtrain/widgets/builders/dialogs.dart';
import 'package:video_player/video_player.dart';
class MediaCard extends StatelessWidget {
const MediaCard({super.key, required this.media, this.callback});
const MediaCard(
{super.key, required this.media, this.callback, this.canDelete});
final MediaItem media;
final bool? canDelete;
final Function? callback;
@override
@ -44,7 +46,9 @@ class MediaCard extends StatelessWidget {
RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
shadowColor: const Color.fromARGB(0, 255, 255, 255),
child: TextButton(
onLongPress: () => showRemovalDialog(
onLongPress: () {
if (canDelete == true) {
showRemovalDialog(
'Media Removal',
'Would you like to permanently remove this media from the current session?',
context, () {
@ -55,7 +59,9 @@ class MediaCard extends StatelessWidget {
if (callback != null) {
callback!();
}
}),
});
}
},
onPressed: () => showMediaDetailWidget(context, media),
child: const ListTile(
title: Text(''),