From 6ffd179f207b7999ef467932dfd560f45285551f Mon Sep 17 00:00:00 2001 From: Florian Griffon Date: Sun, 15 Dec 2024 19:38:35 +0100 Subject: [PATCH] Rebase --- .../lib/features/composition/composition.dart | 53 ++++++------------- .../widgets/alphabet_scroll_page.dart | 29 ---------- .../contacts/widgets/contact_modal.dart | 1 - 3 files changed, 16 insertions(+), 67 deletions(-) diff --git a/dialer/lib/features/composition/composition.dart b/dialer/lib/features/composition/composition.dart index b2dfb7d..783fcf9 100644 --- a/dialer/lib/features/composition/composition.dart +++ b/dialer/lib/features/composition/composition.dart @@ -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 { List _allContacts = []; List _filteredContacts = []; final ContactService _contactService = ContactService(); - final ContactService _contactService = ContactService(); @override void initState() { @@ -83,9 +81,9 @@ class _CompositionPageState extends State { // 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 { 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 { 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 { }, ); }).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 { 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 { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('1'), _buildDialButton('2'), @@ -198,8 +180,7 @@ class _CompositionPageState extends State { ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('4'), _buildDialButton('5'), @@ -207,8 +188,7 @@ class _CompositionPageState extends State { ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('7'), _buildDialButton('8'), @@ -216,8 +196,7 @@ class _CompositionPageState extends State { ], ), Row( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('*'), _buildDialButton('0'), diff --git a/dialer/lib/features/contacts/widgets/alphabet_scroll_page.dart b/dialer/lib/features/contacts/widgets/alphabet_scroll_page.dart index 3ed3fc4..c144084 100644 --- a/dialer/lib/features/contacts/widgets/alphabet_scroll_page.dart +++ b/dialer/lib/features/contacts/widgets/alphabet_scroll_page.dart @@ -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 { final contacts = widget.contacts; final selfContact = ContactState.of(context).selfContact; - final contactState = ContactState.of(context); - final contacts = contactState.contacts; - final selfContact = contactState.selfContact; - Map> alphabetizedContacts = {}; for (var contact in contacts) { String firstLetter = contact.displayName.isNotEmpty @@ -100,8 +94,6 @@ class _AlphabetScrollPageState extends State { return Scaffold( backgroundColor: Colors.black, body: Column( - children: [ - // Top buttons row children: [ // Top buttons row Container( @@ -123,14 +115,11 @@ class _AlphabetScrollPageState extends State { itemBuilder: (context, index) { String letter = alphabetKeys[index]; List contactsForLetter = alphabetizedContacts[letter]!; - List 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 { 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 { ), 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: () { diff --git a/dialer/lib/features/contacts/widgets/contact_modal.dart b/dialer/lib/features/contacts/widgets/contact_modal.dart index 6514500..2d7d395 100644 --- a/dialer/lib/features/contacts/widgets/contact_modal.dart +++ b/dialer/lib/features/contacts/widgets/contact_modal.dart @@ -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;