G-EIP-700-TLS-7-1-eip-steph.../lib/pages/history.dart

75 lines
1.6 KiB
Dart
Raw Normal View History

2024-10-25 11:26:44 +00:00
// history.dart
2024-09-16 15:07:04 +00:00
import 'package:flutter/material.dart';
2024-10-25 11:26:44 +00:00
import 'package:dialer/classes/contactClass.dart';
2024-09-16 15:07:04 +00:00
import 'package:dialer/classes/displayContact.dart';
2024-10-25 11:26:44 +00:00
class History {
final Contact contact;
final DateTime date;
final String callType; // 'incoming' or 'outgoing'
final String callStatus; // 'missed' or 'answered'
final int attempts;
History(
this.contact,
this.date,
this.callType,
this.callStatus,
this.attempts,
);
}
2024-09-16 15:07:04 +00:00
List<History> histories = [
2024-10-25 11:26:44 +00:00
History(
contacts[0],
DateTime.now().subtract(const Duration(hours: 2)),
'outgoing',
'answered',
1,
),
History(
contacts[1],
DateTime.now().subtract(const Duration(hours: 8)),
'incoming',
'missed',
2,
),
History(
contacts[2],
DateTime.now().subtract(const Duration(days: 1, hours: 3)),
'outgoing',
'missed',
1,
),
// Add more histories as needed
2024-09-16 15:07:04 +00:00
];
class HistoryPage extends StatefulWidget {
const HistoryPage({super.key});
@override
_HistoryPageState createState() => _HistoryPageState();
}
class _HistoryPageState extends State<HistoryPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: const Text('History'),
),
body: ListView.builder(
itemCount: histories.length,
itemBuilder: (context, index) {
2024-10-25 11:26:44 +00:00
return DisplayContact(
contact: histories[index].contact,
history: histories[index],
);
2024-09-16 15:07:04 +00:00
},
),
);
}
}