This repository has been archived on 2024-11-18. You can view files and clone it, but cannot push or open issues or pull requests.
dialer/lib/pages/favorites.dart
2024-10-25 12:26:44 +01:00

35 lines
892 B
Dart

// favorites.dart
import 'package:dialer/classes/contactClass.dart';
import 'package:dialer/classes/displayContact.dart';
import 'package:flutter/material.dart';
class FavoritePage extends StatefulWidget {
const FavoritePage({super.key});
@override
_FavoritePageState createState() => _FavoritePageState();
}
class _FavoritePageState extends State<FavoritePage> {
@override
Widget build(BuildContext context) {
// Filter favorite contacts
final favoriteContacts =
contacts.where((contact) => contact.isFavorite).toList();
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: const Text('Favorites'),
),
body: ListView.builder(
itemCount: favoriteContacts.length,
itemBuilder: (context, index) {
return DisplayContact(contact: favoriteContacts[index]);
},
),
);
}
}