パッケージ、リポジトリ、アプリカテゴリを検索

currency_textfield のカバー
パッケージ詳細v5.0.0+1

currency_textfield

通貨テキスト入力用のコントローラーを実装するFlutterパッケージ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
395
いいね数
53
Pub ポイント
160

パッケージをインストール

flutter pub add currency_textfield

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

通貨テキスト入力の処理に特化したコントローラーを提供するFlutterパッケージで、自動フォーマット、マスキング、検証機能を備えています。ユーザーが一貫した形式で金額を入力できるようにし、小数点や通貨記号を自動挿入しながら、無効な文字の入力を防ぎます。正確な財務データ入力が必要なフォームに最適で、モバイル、Web、デスクトップなど複数のプラットフォームをサポートします。このパッケージは、入力エラーを減らし、通貨値の可読性を向上させることで、ユーザー体験を向上させます。

用途

  • 財務フォーム入力
  • 電子商取引チェックアウトフィールド
  • 予算アプリ
  • 請求書および支払いフォーム
  • リアルタイム通貨表示

主な機能

  • 自動小数形式
  • 通貨記号の挿入
  • 入力検証
  • クロスプラットフォーム対応
  • カスタマイズ可能な少数桁数
  • リアルタイムフィードバック

適している対象

  • 金融アプリを開発する開発者
  • 正確な金額入力が必要なアプリ
  • 厳格なデータフォーマットが必要なフォーム
  • マルチプラットフォーム金融ツール
  • 使いやすさと正確性に焦点を当てたUI

注意事項

  • カスタム外観のためには追加のスタイル設定が必要になる場合があります
  • 数値および通貨固有の動作に制限
  • 通貨変換を処理しない
  • TextEditingController の正しい初期化に依存しています
  • 適切に管理されない場合、他のフォーマッターとの潜在的な競合が生じる可能性があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

currency_textfield

Build Status pub package

A Controller for currency text input

Demo

sample

Install

Follow this guide

Usage

Import the library

import 'package:currency_textfield/currency_textfield.dart';

Create the Controller

CurrencyTextFieldController controller = CurrencyTextFieldController()

Parameters and getters

Currency Symbol, Decimal and Thousand separator

It's possible to customize currencySymbol, decimalSymbol and thousandSymbol:

var controller = CurrencyTextFieldController(currencySymbol: "RR", decimalSymbol: ".", thousandSymbol: ",");
Get double value, get int value and get number in string format

To get the number value from controller, you can use both the doubleValue or the intValue properties:

//Double value:
final double val = controller.doubleValue;
//Int value:
final int val = controller.intValue;
//String number:
final int val = controller.textWithoutCurrencySymbol;
Initial value

You can initialize the controller using a int or a double, but not both at the same time. To make this, just use initDoubleValue or initIntValue:

final CurrencyTextFieldController controller2 = CurrencyTextFieldController(initDoubleValue: 10);
final CurrencyTextFieldController controller3 = CurrencyTextFieldController(initIntValue: 1000);

// this will raise an error!
final CurrencyTextFieldController controller4 = CurrencyTextFieldController(initIntValue: 1000,initDoubleValue: 10);
Position of the symbol and separator

You can decide if the symbol will be before or after the number. To make this, just use currencyOnLeft:

// default with the currency before the number
final CurrencyTextFieldController controller = CurrencyTextFieldController();

// currency after the number
final CurrencyTextFieldController controller2 = CurrencyTextFieldController(currencyOnLeft: false);

And also define the separator between the symbol and the value with currencySeparator:

// the default value is a single space
final CurrencyTextFieldController controller = CurrencyTextFieldController(currencySeparator: ' -> ');
Block the user from setting negative numbers

Just set enableNegative to false

Force a value from outside the TextField
final CurrencyTextFieldController controller = CurrencyTextFieldController();
// using a double
controller.forceValue(initDoubleValue: 300.5);

// using an int
controller.forceValue(initIntValue: 10000);
Change the currency symbol of the controller
final CurrencyTextFieldController controller = CurrencyTextFieldController();
// keeping the current value:
controller.replaceCurrencySymbol('EUR');

// reseting the current value:
controller.replaceCurrencySymbol('EUR', resetValue: true);

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。