currency_country_picker 1.2.3 copy "currency_country_picker: ^1.2.3" to clipboard
currency_country_picker: ^1.2.3 copied to clipboard

A flutter package to select country with phone code and currency.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      themeMode: ThemeMode.dark,
      theme: ThemeData.dark(),
      debugShowCheckedModeBanner: false,
      home: const HomePage(),
    );
  }
}

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

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  String countryTitle = 'Country';
  String currencyTitle = 'Currency';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Currency & Country Picker'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              const Text('Country Picker full screen:'),
              ElevatedButton(
                onPressed: () => showCountryPickerFullScreen(
                  context: context,
                  theme: CountryPickerThemeData(
                    countryCodeTextStyle: const TextStyle(
                      color: Color.fromARGB(255, 168, 36, 60),
                      fontSize: 17,
                    ),
                  ),
                  favorites: ['98'],
                  onSelect: (country) {
                    setState(() {
                      countryTitle = country.name;
                    });
                  },
                ),
                child: Text(countryTitle),
              ),
              const Text('Country Picker dialog:'),
              ElevatedButton(
                onPressed: () => showCountryPickerDialog(
                  context: context,
                  theme: CountryPickerThemeData(
                    countryCodeTextStyle: const TextStyle(
                      color: Color.fromARGB(255, 168, 36, 60),
                      fontSize: 17,
                    ),
                  ),
                  showPhoneCode: true,
                  favorites: ['98'],
                  onSelect: (country) {
                    setState(() {
                      countryTitle = country.name;
                    });
                  },
                ),
                child: Text(countryTitle),
              ),
              const SizedBox(height: 50),
              const Text('Currency Picker:'),
              ElevatedButton(
                onPressed: () => showCurrencyPickerBottomSheet(
                  context: context,
                  favorites: ['IRR'],
                  onSelect: (currency) {
                    setState(() {
                      currencyTitle = currency.name;
                    });
                  },
                ),
                child: Text(currencyTitle),
              ),
            ],
          ),
        ));
  }
}
3
likes
145
points
43
downloads

Publisher

verified publisherehsanabaci.ir

Weekly Downloads

A flutter package to select country with phone code and currency.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on currency_country_picker