Pakete, Repositories und App-Kategorien suchen

Paketdetailsv0.0.13

flutter_native_contact_picker

Ein Flutter-Plugin zum Auswählen eines Kontakts aus dem Adressbuch.

AndroidiOS
30-Tage-Downloads
57.700
Likes
82
Pub-Punkte
160

Paket installieren

flutter pub add flutter_native_contact_picker

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Ein Flutter-Plugin, das Benutzern die Auswahl von Kontakten direkt aus dem nativen Adressbuch auf Android- und iOS-Geräten ermöglicht. Es bietet eine nahtlose, plattformnative Schnittstelle für die Kontaktwahl und sorgt für eine konsistente Benutzererfahrung über Plattformen hinweg. Das Plugin integriert sich in das eingebaute Kontakt-System des Geräts und ermöglicht den Zugriff auf Kontaktinformationen wie Namen, Telefonnummern und E-Mail-Adressen. Es ist einfach und zuverlässig gestaltet und daher ideal für Apps, die eine Kontaktintegration benötigen, ohne eigene Kontaktpicker erstellen zu müssen.

Anwendungsfälle

  • Kontaktauswahl in Messaging-Apps integrieren
  • Benutzerprofil-Erstellung über Kontaktimport aktivieren
  • Schnelle Kontaktaustausch-Facilitation
  • Unterstützung der Terminplanung mit Kontaktabfrage
  • CRM-Tools mit Kontaktabruf erstellen

Hauptmerkmale

  • Native Kontaktauswahl-Oberfläche unter Android und iOS
  • Zugriff auf Kontaktdaten wie Name und Telefonnummer
  • Einfache API für die Kontaktwahl
  • Plattformübergreifende Kompatibilität
  • Sichere Datenverarbeitung mit Plattformberechtigungen

Geeignet für

  • Entwickler, die Kommunikations-Apps erstellen
  • Apps, die Funktionen zum Importieren von Kontakten benötigen
  • Werkzeuge zur Leadgenerierung oder Netzwerken
  • Mobile Formulare, die Kontaktangaben erfordern
  • Anwendungen mit Benutzer-Onboarding-Flows

Hinweise

  • Erfordert Laufzeitberechtigung unter Android und iOS
  • Unterstützt möglicherweise nicht alle Kontaktfelder (z. B. Fotos)
  • Abhängig vom nativen Kontakt-Datenbank des Geräts
  • Begrenzte Anpassung der Picker-Oberfläche
  • Erforderliche Fehlerbehandlung bei Berechtigungsverweigerungen

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

flutter_native_contact_picker

With this plugin a Flutter app can ask its user to select a contact or contacts from their address book, with the option to select specific phone numbers. The information associated with the contacts is returned to the app.

This plugin uses the operating system's native UI for selecting contacts and does not require any special permissions from the user, even on Android.

Features

  • [x] iOS Support

    • Select single contact
    • Select multiple contacts
    • Select specific phone number from a contact
    • Returns all phone numbers for selected contacts
  • [x] Android Support

    • Select single contact
    • Select specific phone number from a contact
    • No READ_CONTACTS permission required

Usage

Basic Contact Selection
// Create an instance of the picker
final FlutterNativeContactPicker _contactPicker = FlutterNativeContactPicker();

// Select a single contact
Contact? contact = await _contactPicker.selectContact();
print(contact?.fullName);
print(contact?.phoneNumbers);

// Select multiple contacts (iOS only)
List<Contact>? contacts = await _contactPicker.selectContacts();
for (var contact in contacts ?? []) {
  print(contact.fullName);
  print(contact.phoneNumbers);
}
Phone Number Selection
// Select a specific phone number from a contact
Contact? contact = await _contactPicker.selectPhoneNumber();
print(contact?.fullName);
print(contact?.selectedPhoneNumber); // The specifically selected number
print(contact?.phoneNumbers); // All available numbers (iOS only)

Contact Model

The Contact class provides the following properties:

class Contact {
  final String? fullName;           // Contact's full name
  final List<String>? phoneNumbers; // All phone numbers (iOS: all numbers, Android: selected number only)
  final String? selectedPhoneNumber; // The specifically selected phone number when using selectPhoneNumber()
}

Platform Differences

iOS
  • Minimum iOS 13.0 (Swift Package Manager integration and Flutter FlutterFramework requirement)
  • Supports selecting multiple contacts
  • Returns all phone numbers associated with a contact
  • When using selectPhoneNumber(), returns both the selected number and all available numbers
  • Uses native CNContactPickerViewController
Android
  • Single contact selection only
  • When using selectPhoneNumber(), returns only the selected phone number
  • No READ_CONTACTS permission required
  • Uses native contact picker intent

Example

See the example directory for a complete sample app demonstrating all features.

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final FlutterNativeContactPicker _contactPicker = FlutterNativeContactPicker();
  List<Contact>? _contacts;
  String? _selectedPhoneNumber;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Contact Picker Example App'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              MaterialButton(
                color: Colors.blue,
                textColor: Colors.white,
                child: const Text("Select Contact"),
                onPressed: () async {
                  Contact? contact = await _contactPicker.selectContact();
                  setState(() {
                    _contacts = contact == null ? null : [contact];
                    _selectedPhoneNumber = null;
                  });
                },
              ),
              MaterialButton(
                color: Colors.green,
                textColor: Colors.white,
                child: const Text("Select Phone Number"),
                onPressed: () async {
                  Contact? contact = await _contactPicker.selectPhoneNumber();
                  setState(() {
                    _contacts = contact == null ? null : [contact];
                    _selectedPhoneNumber = contact?.selectedPhoneNumber;
                  });
                },
              ),
              if (_contacts != null) ...[
                ..._contacts!.map(
                  (contact) => Column(
                    children: [
                      Text(contact.fullName ?? 'No name'),
                      if (_selectedPhoneNumber != null)
                        Text('Selected: $_selectedPhoneNumber'),
                      ...?contact.phoneNumbers?.map((number) => Text(number)),
                    ],
                  ),
                ),
              ],
            ],
          ),
        ),
      ),
    );
  }
}

Kategorien

Abhängigkeiten

Abhängigkeiten 1 Einträge

  • plugin_platform_interface^2.0.2

Quell-Repository

Projekte, die dieses Paket verwenden