lajz/currency_pickers
國家、代碼、旗幟、貨幣以及多種選擇方式,近在咫尺……一個組件的距離……
- Stars
- 5
- Forks
- 5
- 最近推送(UTC)
- 2023年7月4日
- 專案狀態
- 未封存
語言DartObjective-CJava
使用的依賴
依賴清單 2 項
- flutter
{"sdk":"flutter"} - flutter_test開發依賴
{"sdk":"flutter"}
原始 README
以下為英文專案原文快照,最新內容請造訪 GitHub。
展開 / 收合專案 README
currency_pickers
Currency picker for flutter
CurrencyPickerDropdown example
CurrencyPickerDropdown(
initialValue: 'tr',
itemBuilder: _buildDropdownItem,
onValuePicked: (Country country) {
print("${country.name}");
},
),
Widget _buildDropdownItem(Country country) => Container(
child: Row(
children: <Widget>[
CurrencyPickerUtils.getDefaultFlagImage(country),
SizedBox(
width: 8.0,
),
Text("+${country.currencyCode}(${country.isoCode})"),
],
),
);
CurrencyPickerDialog example
void _openCurrencyPickerDialog() => showDialog(
context: context,
builder: (context) => Theme(
data: Theme.of(context).copyWith(primaryColor: Colors.pink),
child: CurrencyPickerDialog(
titlePadding: EdgeInsets.all(8.0),
searchCursorColor: Colors.pinkAccent,
searchInputDecoration: InputDecoration(hintText: 'Search...'),
isSearchable: true,
title: Text('Select your phone code'),
onValuePicked: (Country country) =>
setState(() => _selectedDialogCountry = country),
itemBuilder: _buildDialogItem)),
);
CurrencyPickerCupertino example
void _openCupertinoCurrencyPicker() => showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) {
return CurrencyPickerCupertino(
pickerSheetHeight: 300.0,
onValuePicked: (Country country) =>
setState(() => _selectedCupertinoCountry = country),
);
});
Credits
Forked from country_pickers repo. Thanks goes to country-flags repo for the flag image assets.