75 lines
1.6 KiB
Dart
75 lines
1.6 KiB
Dart
// history.dart
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:dialer/classes/contactClass.dart';
|
|
import 'package:dialer/classes/displayContact.dart';
|
|
|
|
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,
|
|
);
|
|
}
|
|
|
|
List<History> histories = [
|
|
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
|
|
];
|
|
|
|
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) {
|
|
return DisplayContact(
|
|
contact: histories[index].contact,
|
|
history: histories[index],
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|