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/features/favorites/favorites_page.dart

39 lines
997 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: contacts.length,
itemBuilder: (context, index) {
if (contacts[index].isFavorite) {
return DisplayContact(contact: contacts[index]);
} else {
return const SizedBox.shrink();
}
},
),
);
}
}