Initial commit
This commit is contained in:
40
lib/presentation/analysis/widgets/analysis_session_list.dart
Normal file
40
lib/presentation/analysis/widgets/analysis_session_list.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
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),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user