42 lines
1.1 KiB
Dart
42 lines
1.1 KiB
Dart
// contact.dart
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:dialer/classes/contactClass.dart';
|
|
import 'package:dialer/classes/displayContact.dart';
|
|
|
|
class ContactPage extends StatefulWidget {
|
|
const ContactPage({super.key});
|
|
|
|
@override
|
|
_ContactPageState createState() => _ContactPageState();
|
|
}
|
|
|
|
class _ContactPageState extends State<ContactPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Optionally sort contacts alphabetically
|
|
final sortedContacts = [...contacts]..sort((a, b) => a.name.compareTo(b.name));
|
|
|
|
return Scaffold(
|
|
backgroundColor: Colors.black,
|
|
appBar: AppBar(
|
|
title: const Text('Contacts'),
|
|
),
|
|
body: ListView.builder(
|
|
itemCount: sortedContacts.length,
|
|
itemBuilder: (context, index) {
|
|
return DisplayContact(contact: sortedContacts[index]);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<Contact> contacts = [
|
|
Contact('Alice', '1234567890'),
|
|
Contact('Bob', '0987654321', isFavorite: true, isLocked: true, publicKey: 'AB...YZ'),
|
|
Contact('Charlie', '5555555555', isLocked: true),
|
|
];
|