33 lines
847 B
Dart
33 lines
847 B
Dart
import 'package:dialer/classes/displayContact.dart';
|
|
import 'package:dialer/pages/contact.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) {
|
|
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();
|
|
}
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|