An open API service indexing awesome lists of open source software.

https://github.com/dnizfor/flutter_language_select

Useful and customizable language picker.
https://github.com/dnizfor/flutter_language_select

flutter flutter-localization

Last synced: 13 days ago
JSON representation

Useful and customizable language picker.

Awesome Lists containing this project

README

          

light_theme
dark_theme

# Flutter Language Select

`FlutterLanguageSelect` is a customizable widget for Flutter projects that allows users to easily select a language from a list. It displays available languages as cards and returns the selected language code and name through a callback.

---

## ✨ Features

* 📜 Built-in language list (`Utils.languagesData`).
* 🎨 Fully customizable:

* Card background colors (`tileColor`, `selectedTileColor`)
* Border colors (`borderColor`, `selectedBorderColor`)
* Title colors (`titleColor`, `selectedTitleColor`)
* Custom trailing icon (`trailing`)
* 📌 Support for initial selected language (`initialLanguageCode`).
* 🔄 Callback function `onSelect` returns **language code** and **name**.
* 🚀 Automatically scrolls to the initially selected language.
* 🌍 141 Supported Languages [See supported languages](#-supported-languages)

---

## 📦 Installation

Add to your `pubspec.yaml`:

```yaml
dependencies:
flutter_language_select: ^0.0.2
```

or

```bash
flutter pub add flutter_language_select
```

Then import it:

```dart
import 'package:flutter_language_select/flutter_language_select.dart';
```

---

## 🚀 Usage

```dart
FlutterLanguageSelect(
onSelect: (code, name) {
print("Selected language: $name ($code)");
},
initialLanguageCode: "en", // Pre-selected language
tileColor: Colors.white,
selectedTileColor: Colors.blue.shade50,
borderColor: Colors.grey.shade300,
selectedBorderColor: Colors.blue,
titleColor: Colors.black,
selectedTitleColor: Colors.blue,
trailing: const Icon(Icons.check, color: Colors.blue, size: 24),
),
```

[See supported languages](#-supported-languages)

---

## 📚 Parameters

| Parameter | Type | Default | Description |
| --------------------- | -------- | ------------------------ | -------------------------------------------- |
| `onSelect` | Function | **required** | Returns the selected language code and name. |
| `tileColor` | Color | `Colors.white` | Background color of unselected cards. |
| `selectedTileColor` | Color | `Colors.white` | Background color of the selected card. |
| `borderColor` | Color | `Colors.transparent` | Border color of unselected cards. |
| `selectedBorderColor` | Color | `Colors.blue` | Border color of the selected card. |
| `titleColor` | Color | `Colors.black` | Title color of unselected cards. |
| `selectedTitleColor` | Color | `Colors.blue` | Title color of the selected card. |
| `trailing` | Icon | `Icon(Icons.check, ...)` | Icon displayed on the selected card. |
| `initialLanguageCode` | String | `''` | Language code to be pre-selected. |

---
## 🌍 Supported Languages

| Language | Code | Language | Code |
|--------------------------|--------|----------------------|--------|
| Akan | ak | Lao | lo |
| Amharic | am | Lithuanian | lt |
| Arabic | ar | Luba-Katanga | lu |
| Assamese | l_as | Latvian | lv |
| Aymara | ay | Malagasy | mg |
| Azerbaijani | az | Marshallese | mh |
| Belarusian | be | Maori | mi |
| Bulgarian | bg | Macedonian | mk |
| Bhojpuri | bho | Malayalam | ml |
| Bislama | bi | Mongolian | mn |
| Bambara | bm | Marathi | mr |
| Bengali | bn | Western Mari | mrj |
| Bosnian | bs | Malay | ms |
| Catalan | ca | Maltese | mt |
| Cebuano | ceb | Burmese | my |
| Chamorro | ch | Nauru | na |
| Mari | chm | Norwegian Bokmål | nb |
| Corsican | co | North Ndebele | nd |
| Czech | cs | Nepali | ne |
| Welsh | cy | Dutch | nl |
| Danish | da | Norwegian Nynorsk | nn |
| German | de | Norwegian | no |
| Divehi | dv | South Ndebele | nr |
| Dzongkha | dz | Chichewa | ny |
| Greek | el | Punjabi | pa |
| English | en | Papiamento | pap |
| Spanish | es | Polish | pl |
| Estonian | et | Pashto | ps |
| Basque | eu | Portuguese | pt |
| Persian | fa | Rundi | rn |
| Finnish | fi | Romanian | ro |
| Filipino | fil | Russian | ru |
| Fijian | fj | Kinyarwanda | rw |
| Faroese | fo | Sindhi | sd |
| French | fr | Sango | sg |
| Irish | ga | Sinhala | si |
| Galician | gl | Slovak | sk |
| Guarani | gn | Slovenian | sl |
| Gujarati | gu | Samoan | sm |
| Manx | gv | Shona | sn |
| Hausa | ha | Somali | so |
| Hawaiian | haw | Albanian | sq |
| Hebrew | he | Serbian | sr |
| Hindi | hi | Swati | ss |
| Hiri Motu | ho | Southern Sotho | st |
| Croatian | hr | Sundanese | su |
| Haitian | ht | Swedish | sv |
| Hungarian | hu | Swahili | sw |
| Armenian | hy | Tamil | ta |
| Indonesian | id | Telugu | te |
| Igbo | ig | Tajik | tg |
| Iloko | ilo | Thai | th |
| Icelandic | l_is | Turkmen | tk |
| Italian | it | Tagalog | tl |
| Japanese | ja | Tswana | tn |
| Javanese | jv | Tonga | to |
| Georgian | ka | Turkish | tr |
| Kazakh | kk | Tahitian | ty |
| Kalaallisut | kl | Ukrainian | uk |
| Central Khmer | km | Urdu | ur |
| Kannada | kn | Uzbek | uz |
| Korean | ko | Vietnamese | vi |
| Krio | kri | Xhosa | xh |
| Kurdish | ku | Yiddish | yi |
| Kirghiz | ky | Yoruba | yo |
| Latin | la | Yucateco | yua |
| Luxembourgish | lb | Chinese - Traditional| zh_TW |
| Ganda | lg | Chinese | zh |
| Lingala | ln | Zulu | zu |

---

## ⚡ Contributing

Contributions, issues, and feature requests are welcome! 🚀