parent
c46a43aa4e
commit
6ffd179f20
@ -1,7 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_contacts/flutter_contacts.dart';
|
||||
import '../../widgets/contact_service.dart';
|
||||
import '../../widgets/contact_service.dart';
|
||||
|
||||
class CompositionPage extends StatefulWidget {
|
||||
const CompositionPage({super.key});
|
||||
@ -15,7 +14,6 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
List<Contact> _allContacts = [];
|
||||
List<Contact> _filteredContacts = [];
|
||||
final ContactService _contactService = ContactService();
|
||||
final ContactService _contactService = ContactService();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -83,9 +81,9 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
// Top half: Display contacts matching dialed number
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 42.0, left: 16.0, right: 16.0, bottom: 16.0),
|
||||
child:
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 42.0, left: 16.0, right: 16.0, bottom: 16.0),
|
||||
color: Colors.black,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -97,14 +95,12 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
contact.displayName,
|
||||
style:
|
||||
const TextStyle(color: Colors.white),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
subtitle: contact.phones.isNotEmpty
|
||||
? Text(
|
||||
contact.phones.first.number,
|
||||
style: const TextStyle(
|
||||
color: Colors.grey),
|
||||
style: const TextStyle(color: Colors.grey),
|
||||
)
|
||||
: null,
|
||||
trailing: Row(
|
||||
@ -112,22 +108,16 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
children: [
|
||||
// Call button
|
||||
IconButton(
|
||||
icon: Icon(Icons.phone,
|
||||
color: Colors.green[300],
|
||||
size: 20),
|
||||
icon: Icon(Icons.phone, color: Colors.green[300], size: 20),
|
||||
onPressed: () {
|
||||
print(
|
||||
'Calling ${contact.displayName}');
|
||||
print('Calling ${contact.displayName}');
|
||||
},
|
||||
),
|
||||
// Text button
|
||||
IconButton(
|
||||
icon: Icon(Icons.message,
|
||||
color: Colors.blue[300],
|
||||
size: 20),
|
||||
icon: Icon(Icons.message, color: Colors.blue[300], size: 20),
|
||||
onPressed: () {
|
||||
print(
|
||||
'Texting ${contact.displayName}');
|
||||
print('Texting ${contact.displayName}');
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -137,12 +127,7 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
},
|
||||
);
|
||||
}).toList()
|
||||
: [
|
||||
Center(
|
||||
child: Text('No contacts found',
|
||||
style:
|
||||
TextStyle(color: Colors.white)))
|
||||
],
|
||||
: [Center(child: Text('No contacts found', style: TextStyle(color: Colors.white)))],
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -167,16 +152,14 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
dialedNumber,
|
||||
style: const TextStyle(
|
||||
fontSize: 24, color: Colors.white),
|
||||
style: const TextStyle(fontSize: 24, color: Colors.white),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: _onClearPress,
|
||||
icon: const Icon(Icons.backspace,
|
||||
color: Colors.white),
|
||||
icon: const Icon(Icons.backspace, color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -189,8 +172,7 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_buildDialButton('1'),
|
||||
_buildDialButton('2'),
|
||||
@ -198,8 +180,7 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_buildDialButton('4'),
|
||||
_buildDialButton('5'),
|
||||
@ -207,8 +188,7 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_buildDialButton('7'),
|
||||
_buildDialButton('8'),
|
||||
@ -216,8 +196,7 @@ class _CompositionPageState extends State<CompositionPage> {
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
_buildDialButton('*'),
|
||||
_buildDialButton('0'),
|
||||
|
@ -2,11 +2,9 @@ import 'package:dialer/widgets/username_color_generator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_contacts/flutter_contacts.dart';
|
||||
import '../contact_state.dart';
|
||||
import '../contact_state.dart';
|
||||
import '../../../widgets/color_darkener.dart';
|
||||
import 'add_contact_button.dart';
|
||||
import 'contact_modal.dart';
|
||||
import 'contact_modal.dart';
|
||||
import 'share_own_qr.dart';
|
||||
|
||||
class AlphabetScrollPage extends StatefulWidget {
|
||||
@ -80,10 +78,6 @@ class _AlphabetScrollPageState extends State<AlphabetScrollPage> {
|
||||
final contacts = widget.contacts;
|
||||
final selfContact = ContactState.of(context).selfContact;
|
||||
|
||||
final contactState = ContactState.of(context);
|
||||
final contacts = contactState.contacts;
|
||||
final selfContact = contactState.selfContact;
|
||||
|
||||
Map<String, List<Contact>> alphabetizedContacts = {};
|
||||
for (var contact in contacts) {
|
||||
String firstLetter = contact.displayName.isNotEmpty
|
||||
@ -100,8 +94,6 @@ class _AlphabetScrollPageState extends State<AlphabetScrollPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Column(
|
||||
children: [
|
||||
// Top buttons row
|
||||
children: [
|
||||
// Top buttons row
|
||||
Container(
|
||||
@ -123,14 +115,11 @@ class _AlphabetScrollPageState extends State<AlphabetScrollPage> {
|
||||
itemBuilder: (context, index) {
|
||||
String letter = alphabetKeys[index];
|
||||
List<Contact> contactsForLetter = alphabetizedContacts[letter]!;
|
||||
List<Contact> contactsForLetter = alphabetizedContacts[letter]!;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Alphabet Letter Header
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0, horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8.0, horizontal: 16.0),
|
||||
child: Text(
|
||||
@ -150,17 +139,12 @@ class _AlphabetScrollPageState extends State<AlphabetScrollPage> {
|
||||
Color avatarColor =
|
||||
generateColorFromName(contact.displayName);
|
||||
return ListTile(
|
||||
leading: (contact.thumbnail != null &&
|
||||
contact.thumbnail!.isNotEmpty)
|
||||
leading: (contact.thumbnail != null &&
|
||||
contact.thumbnail!.isNotEmpty)
|
||||
? CircleAvatar(
|
||||
backgroundImage:
|
||||
MemoryImage(contact.thumbnail!),
|
||||
)
|
||||
backgroundImage:
|
||||
MemoryImage(contact.thumbnail!),
|
||||
)
|
||||
: CircleAvatar(
|
||||
backgroundColor: avatarColor,
|
||||
child: Text(
|
||||
@ -173,19 +157,6 @@ class _AlphabetScrollPageState extends State<AlphabetScrollPage> {
|
||||
),
|
||||
title: Text(contact.displayName,
|
||||
style: TextStyle(color: Colors.white)),
|
||||
subtitle: Text(phoneNumber,
|
||||
style: TextStyle(color: Colors.white70)),
|
||||
backgroundColor: avatarColor,
|
||||
child: Text(
|
||||
contact.displayName.isNotEmpty
|
||||
? contact.displayName[0].toUpperCase()
|
||||
: '?',
|
||||
style: TextStyle(
|
||||
color: darken(avatarColor, 0.4)),
|
||||
),
|
||||
),
|
||||
title: Text(contact.displayName,
|
||||
style: TextStyle(color: Colors.white)),
|
||||
subtitle: Text(phoneNumber,
|
||||
style: TextStyle(color: Colors.white70)),
|
||||
onTap: () {
|
||||
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_contacts/flutter_contacts.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:dialer/widgets/username_color_generator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ContactModal extends StatelessWidget {
|
||||
final Contact contact;
|
||||
|
Loading…
Reference in New Issue
Block a user