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