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

パッケージ詳細v1.0.0+9

number_text_input_formatter

Flutter 向けの数値テキスト入力フォーマッタ

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3
いいね数
32
Pub ポイント
130

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

flutter pub add number_text_input_formatter

パッケージ概要

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

テキスト入力を数値としてフォーマットするFlutterパッケージで、小数点、桁区切り、マイナス記号を自動的に処理します。ユーザーの入力が数値の規則に従うことを保証し、テキストフィールドではクリーンで読みやすい形式を維持します。価格、数量、測定値など数値入力が必要なフォームに最適です。このフォーマッターはAndroid、iOS、Web、macOS、Windows、Linuxなどすべての主要プラットフォームで動作し、デバイスに関係なく一貫した挙動を提供します。小数精度やロケール固有のフォーマットのカスタマイズもサポートしています。

用途

  • 価格用のフォーム入力
  • フォーマット付きの数量入力
  • 測定データ収集
  • 金融アプリケーション
  • 使いやすい数値入力
  • リアルタイム検証付きのデータ入力

主な機能

  • 数値の自動フォーマット
  • 小数および負の数値のサポート
  • 千単位区切りのサポート
  • カスタマイズ可能な小数精度
  • クロスプラットフォームの一貫性
  • ロケール対応フォーマット

適している対象

  • 金融アプリを開発する開発者
  • 数値入力が必要なフォーム
  • リアルタイムの入力フィードバックが必要なアプリケーション
  • マルチプラットフォーム Flutter プロジェクト
  • 形式化された数値入力を好むユーザー

注意事項

  • エッジケースに対する追加の検証が必要になる場合があります
  • 正しく設定されていない場合、キーボードナビゲーションに影響を与える可能性があります
  • 数値形式のみに制限されています
  • デフォルトでは非数値文字を処理しない
  • 高頻度の更新によるパフォーマンスへの影響

元の README

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

Number Text Input Formatter

Number Text Input Formatter for Flutter.

Installation

dependencies:
  number_text_input_formatter: ^1.0.0

Usage

NumberTextInputFormatter

General-purpose formatter for numeric input fields.

TextField(
  inputFormatters: [
    NumberTextInputFormatter(
      integerDigits: 10,
      decimalDigits: 2,
      maxValue: '1000000000.00',
      decimalSeparator: '.',
      groupDigits: 3,
      groupSeparator: ',',
      allowNegative: false,
      overrideDecimalPoint: true,
      insertDecimalPoint: false,
      insertDecimalDigits: true,
    ),
  ],
  keyboardType: TextInputType.number,
),
Parameters
Parameter Type Default Description
integerDigits int? null Maximum number of integer digits. Must be > 0 if provided.
decimalDigits int? null Maximum number of decimal digits. Must be >= 0 if provided.
maxValue String? null Maximum allowed value (e.g. '9999.99'). Infers integerDigits and decimalDigits if not set.
decimalSeparator String '.' Character used as the decimal point. Must be a single character.
groupDigits int? null Group integer digits every N digits (e.g. 3 for thousands). Must be > 1 if provided.
groupSeparator String ',' Character used as the grouping separator. Must be a single character, different from decimalSeparator.
allowNegative bool false Whether to allow negative numbers.
fixNumber bool true Inserts 0 before a leading decimal point, and 0 after a trailing decimal point.
insertDecimalPoint bool false Automatically inserts the decimal point as the user types (e.g. 123 → 1.23). Requires decimalDigits to be set.
insertDecimalDigits bool false Always appends decimal digits with zeros (e.g. 5 → 5.00). Requires decimalDigits to be set.
overrideDecimalPoint bool false When a second decimal point is typed, moves the decimal point to the new position instead of ignoring it.
prefix String? null String prepended to the formatted value (e.g. '\$ ').
suffix String? null String appended to the formatted value (e.g. ' USD').

CurrencyTextInputFormatter

Pre-configured formatter for currency input. Defaults: 2 decimal digits, grouping every 3 digits, decimal point auto-inserted.

TextField(
  inputFormatters: [
    CurrencyTextInputFormatter(
      prefix: '\$ ',
    ),
  ],
  keyboardType: TextInputType.number,
),
Parameters

Same as NumberTextInputFormatter with these defaults:

Parameter Default
decimalDigits 2
groupDigits 3
insertDecimalPoint true

PercentageTextInputFormatter

Pre-configured formatter for percentage input. Defaults: max 100, 0 decimal digits, decimal digits always inserted.

TextField(
  inputFormatters: [
    PercentageTextInputFormatter(
      suffix: '%',
    ),
  ],
  keyboardType: TextInputType.number,
),
Parameters

Same as NumberTextInputFormatter with these defaults:

Parameter Default
integerDigits 3 (minimum 3)
decimalDigits 0
insertDecimalDigits true

The maxValue is automatically computed from integerDigits and decimalDigits (e.g. integerDigits: 3 → max 100).

カテゴリー

ソースリポジトリ

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

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