FLUTTER ECOSYSTEM

gtgalone/currency_text_input_formatter

Flutter용 통화 텍스트 입력 포맷터입니다.

currency_text_input_formatter 프로젝트 이미지
Stars
52
Forks
35
최근 푸시(UTC)
2026. 8. 21.
프로젝트 상태
활성
Jehun Seem(심제훈) GitHub avatar
GITHUB User

Jehun Seem(심제훈) ↗

Glory to God alone! Flutter, React(next.js), GraphQL, Docker, Serverless, Micro Service. Any questions : jehunseem@gmail.com.

dSPECTERSouth Korea
언어DartHTML

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 4 개
  • flutter{"sdk":"flutter"}
  • intl>=0.17.0 <1.0.0
  • flutter_test개발 의존성{"sdk":"flutter"}
  • test개발 의존성^1.15.7

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

Currency Text Input Formatter

pub package

Currency Text Input Formatter for Flutter. https://pub.dev/packages/currency_text_input_formatter

Installation

Solving Intl package conflict

Add this code end of pubspec.yaml.

dependency_overrides:
  intl: your intl package version

Usage

Basic
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Flutter'),
        ),
        body: Center(
          child: TextField(
            inputFormatters: [CurrencyTextInputFormatter.currency()],
            // inputFormatters: [CurrencyTextInputFormatter.simpleCurrency()], < for simple
            // inputFormatters: [CurrencyTextInputFormatter()], < for basic
            keyboardType: TextInputType.number,
          ),
        ),
      ),
    );
  }
}
With initialValue
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Welcome to Flutter'),
        ),
        body: Center(
          child: MyFormField(),
        ),
      ),
    );
  }
}

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

  @override
  State<MyFormField> createState() => _MyFormFieldState();
}

class _MyFormFieldState extends State<MyFormField> {
  final CurrencyTextInputFormatter _formatter = CurrencyTextInputFormatter.currency();

  @override
  Widget build(BuildContext context) {
    return TextFormField(
      initialValue: _formatter.formatString('2000'),
      inputFormatters: <TextInputFormatter>[_formatter],
      keyboardType: TextInputType.number,
    );
  }
}
Custom Options
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Welcome to Flutter'),
        ),
        body: Center(
          child: TextField(
            inputFormatters: <TextInputFormatter>[
              CurrencyTextInputFormatter.currency(
                locale: 'ko',
                decimalDigits: 0,
                symbol: 'KRW(원) ',
              ),
            ],
            keyboardType: TextInputType.number,
          ),
        ),
      ),
    );
  }
}
With built-in methods
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Welcome to Flutter'),
        ),
        body: Center(
          child: MyFormField(),
        ),
      ),
    );
  }
}

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

  @override
  State<MyFormField> createState() => _MyFormFieldState();
}

class _MyFormFieldState extends State<MyFormField> {
  final CurrencyTextInputFormatter _formatter = CurrencyTextInputFormatter.currency();

  @override
  Widget build(BuildContext context) {
    // Built-in Methods
    print(_formatter.getFormattedValue()); // $ 2,000
    print(_formatter.getUnformattedValue()); // 2000.00
    print(_formatter.formatString('2000')); // $ 2,000
    print(_formatter.formatDouble(20.00)); // $ 20

    return TextFormField(
      inputFormatters: <TextInputFormatter>[_formatter],
      keyboardType: TextInputType.number,
    );
  }
}

Recommend Libraries

Maintainer

License

MIT