41 lines
1.2 KiB
Dart
41 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:trainhub_flutter/domain/entities/analysis_session.dart';
|
|
|
|
class AnalysisSessionList extends StatelessWidget {
|
|
final List<AnalysisSessionEntity> sessions;
|
|
final Function(AnalysisSessionEntity) onSessionSelected;
|
|
final Function(AnalysisSessionEntity) onDeleteSession;
|
|
|
|
const AnalysisSessionList({
|
|
super.key,
|
|
required this.sessions,
|
|
required this.onSessionSelected,
|
|
required this.onDeleteSession,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (sessions.isEmpty) {
|
|
return const Center(
|
|
child: Text('No analysis sessions yet. Tap + to create one.'),
|
|
);
|
|
}
|
|
return ListView.builder(
|
|
itemCount: sessions.length,
|
|
itemBuilder: (context, index) {
|
|
final session = sessions[index];
|
|
return ListTile(
|
|
leading: const CircleAvatar(child: Icon(Icons.video_library)),
|
|
title: Text(session.name),
|
|
subtitle: Text(session.date),
|
|
trailing: IconButton(
|
|
icon: const Icon(Icons.delete_outline),
|
|
onPressed: () => onDeleteSession(session),
|
|
),
|
|
onTap: () => onSessionSelected(session),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|