G-EIP-700-TLS-7-1-eip-steph.../lib/pages/history.dart
2024-09-16 18:07:04 +03:00

51 lines
1.7 KiB
Dart

import 'package:dialer/classes/contactClass.dart';
import 'package:dialer/pages/contact.dart';
import 'package:flutter/material.dart';
import 'package:dialer/classes/displayContact.dart';
List<History> histories = [
History(contacts[0], DateTime.now().subtract(const Duration(hours: 2))),
History(contacts[1], DateTime.now().subtract(const Duration(hours: 8))),
History(contacts[2], DateTime.now().subtract(const Duration(days: 3, hours: 4))),
History(contacts[3], DateTime.now().subtract(const Duration(days: 4, hours: 5))),
History(contacts[4], DateTime.now().subtract(const Duration(days: 5, hours: 6))),
History(contacts[5], DateTime.now().subtract(const Duration(days: 6, hours: 7))),
History(contacts[6], DateTime.now().subtract(const Duration(days: 7, hours: 8))),
History(contacts[7], DateTime.now().subtract(const Duration(days: 8, hours: 9))),
History(contacts[8], DateTime.now().subtract(const Duration(days: 9, hours: 10))),
History(contacts[9], DateTime.now().subtract(const Duration(days: 10, hours: 11))),
];
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]);
},
),
);
}
}
class History {
final Contact contact;
final DateTime date;
History(this.contact, this.date);
}