diff --git a/dialer/lib/features/composition/composition.dart b/dialer/lib/features/composition/composition.dart index 37283fc..5be09be 100644 --- a/dialer/lib/features/composition/composition.dart +++ b/dialer/lib/features/composition/composition.dart @@ -1,7 +1,9 @@ +// lib/pages/composition_page.dart + import 'package:flutter/material.dart'; import 'package:flutter_contacts/flutter_contacts.dart'; import 'package:url_launcher/url_launcher.dart'; -import '../../widgets/contact_service.dart'; +import '../../services/contact_service.dart'; import '../contacts/widgets/add_contact_button.dart'; class CompositionPage extends StatefulWidget { @@ -107,50 +109,50 @@ class _CompositionPageState extends State { child: ListView( children: _filteredContacts.isNotEmpty ? _filteredContacts.map((contact) { - final phoneNumber = contact.phones.isNotEmpty - ? contact.phones.first.number - : 'No phone number'; - return ListTile( - title: Text( - '${contact.displayName.isNotEmpty ? contact.displayName[0] : ''}...${contact.displayName.isNotEmpty ? contact.displayName[contact.displayName.length - 1] : ''}', - // contact.displayName - style: - const TextStyle(color: Colors.white), - ), - subtitle: Text( - '${phoneNumber.isNotEmpty ? phoneNumber[0] : ''}...${phoneNumber.isNotEmpty ? phoneNumber[phoneNumber.length - 1] : ''}', - // phoneNumber, - style: - const TextStyle(color: Colors.grey), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - // Call button - IconButton( - icon: Icon(Icons.phone, - color: Colors.green[300], - size: 20), - onPressed: () { - _launchPhoneDialer(phoneNumber); - }, - ), - // Message button - IconButton( - icon: Icon(Icons.message, - color: Colors.blue[300], - size: 20), - onPressed: () { - _launchSms(phoneNumber); - }, - ), - ], - ), - onTap: () { - // Handle contact selection if needed + final phoneNumber = contact.phones.isNotEmpty + ? contact.phones.first.number + : 'No phone number'; + return ListTile( + title: Text( + '${contact.displayName.isNotEmpty ? contact.displayName[0] : ''}...${contact.displayName.isNotEmpty ? contact.displayName[contact.displayName.length - 1] : ''}', + // contact.displayName + style: + const TextStyle(color: Colors.white), + ), + subtitle: Text( + '${phoneNumber.isNotEmpty ? phoneNumber[0] : ''}...${phoneNumber.isNotEmpty ? phoneNumber[phoneNumber.length - 1] : ''}', + // phoneNumber, + style: + const TextStyle(color: Colors.grey), + ), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // Call button + IconButton( + icon: Icon(Icons.phone, + color: Colors.green[300], + size: 20), + onPressed: () { + _launchPhoneDialer(phoneNumber); }, - ); - }).toList() + ), + // Message button + IconButton( + icon: Icon(Icons.message, + color: Colors.blue[300], + size: 20), + onPressed: () { + _launchSms(phoneNumber); + }, + ), + ], + ), + onTap: () { + // Handle contact selection if needed + }, + ); + }).toList() : [], ), ), @@ -199,7 +201,7 @@ class _CompositionPageState extends State { children: [ Row( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('1'), _buildDialButton('2'), @@ -208,7 +210,7 @@ class _CompositionPageState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('4'), _buildDialButton('5'), @@ -217,7 +219,7 @@ class _CompositionPageState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('7'), _buildDialButton('8'), @@ -226,7 +228,7 @@ class _CompositionPageState extends State { ), Row( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + MainAxisAlignment.spaceEvenly, children: [ _buildDialButton('*'), _buildDialButton('0'), diff --git a/dialer/lib/features/contacts/contact_state.dart b/dialer/lib/features/contacts/contact_state.dart index b6cf003..58e7574 100644 --- a/dialer/lib/features/contacts/contact_state.dart +++ b/dialer/lib/features/contacts/contact_state.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_contacts/flutter_contacts.dart'; -import '../../widgets/contact_service.dart'; +import '../../services/contact_service.dart'; class ContactState extends StatefulWidget { final Widget child; diff --git a/dialer/lib/features/contacts/widgets/contact_modal.dart b/dialer/lib/features/contacts/widgets/contact_modal.dart index 66cfdda..4f99974 100644 --- a/dialer/lib/features/contacts/widgets/contact_modal.dart +++ b/dialer/lib/features/contacts/widgets/contact_modal.dart @@ -2,7 +2,7 @@ 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 '../../../widgets/block_service.dart'; +import '../../../services/block_service.dart'; class ContactModal extends StatefulWidget { final Contact contact; diff --git a/dialer/lib/features/home/home_page.dart b/dialer/lib/features/home/home_page.dart index dbfc84f..23530a1 100644 --- a/dialer/lib/features/home/home_page.dart +++ b/dialer/lib/features/home/home_page.dart @@ -5,7 +5,7 @@ import 'package:dialer/features/history/history_page.dart'; import 'package:dialer/features/composition/composition.dart'; import 'package:flutter_contacts/flutter_contacts.dart'; import 'package:dialer/features/settings/settings.dart'; -import '../../widgets/contact_service.dart'; +import '../../services/contact_service.dart'; class _MyHomePageState extends State with SingleTickerProviderStateMixin { diff --git a/dialer/lib/widgets/block_service.dart b/dialer/lib/services/block_service.dart similarity index 100% rename from dialer/lib/widgets/block_service.dart rename to dialer/lib/services/block_service.dart diff --git a/dialer/lib/widgets/contact_service.dart b/dialer/lib/services/contact_service.dart similarity index 100% rename from dialer/lib/widgets/contact_service.dart rename to dialer/lib/services/contact_service.dart