smart_phone_numb 0.2.3 copy "smart_phone_numb: ^0.2.3" to clipboard
smart_phone_numb: ^0.2.3 copied to clipboard

A Flutter package for a smart phone number field that automatically suggests the country code and sets the phone number length dynamically based on timezone.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:smart_phone_numb/smart_phone_numb.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Smart Phone Number Field Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Smart Phone Number Field'),
      ),
      body: const Padding(
        padding: EdgeInsets.all(16.0),
        child: Column(
          children: [
            Text(
              'Default configuration (US as default country):',
              style: TextStyle(fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 8),
            SmartPhoneNumberField(),
            SizedBox(height: 20),
            Text(
              'Custom configuration (Germany as default, European countries as favorites):',
              style: TextStyle(fontWeight: FontWeight.bold),
            ),
            SizedBox(height: 8),
            SmartPhoneNumberField(
              defaultCountryCode: 'DE',
              favoriteCountries: ['+49', 'DE', '+44', 'GB', '+33', 'FR'],
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
160
points
121
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for a smart phone number field that automatically suggests the country code and sets the phone number length dynamically based on timezone.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

country_code_picker, flutter, flutter_timezone

More

Packages that depend on smart_phone_numb