A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

Overview

PatternFormatter

pub package codecov

A Flutter package provides some implementations of TextInputFormatter that format input with pre-defined patterns

How to use

import 'package:pattern_formatter/pattern_formatter.dart';

Thousands grouping

  • Integer number:

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    ThousandsFormatter()
  ],
)
  • Decimal number:

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    ThousandsFormatter(allowFraction: true)
  ],
)

Card number grouping

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    CreditCardFormatter(),
  ],
)

Date format

TextField(
  keyboardType: TextInputType.number,
  inputFormatters: [
    DateInputFormatter(),
  ],
)
Comments
  • Feature: Support international number separators

    Feature: Support international number separators

    I tested with Spanish and the ThousandsFormatter still uses commas for thousands and a period for the decimal separator.

    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          locale: Locale("es", "ES"),
          supportedLocales: [
            Locale("en", "US"),
            Locale("es", "ES"),
          ],
          localizationsDelegates: [
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
      }
    }
    
    opened by codegrue 4
  • Incompatibility flutter 1.12.13-hotfixes

    Incompatibility flutter 1.12.13-hotfixes

    Because localize depends on flutter_localizations any from sdk which depends on intl 0.16.0, intl 0.16.0 is required. So, because localize depends on intl ^0.15.7, version solving failed. pub get failed (1; So, because localize depends on intl ^0.15.7, version solving failed.)

    bug 
    opened by guikebr 3
  • Null safety

    Null safety

    Hi, I migrated the package to null safaty support. I took advantage of the opportunity for to migrate the project to AndroidX and do some other update stuffs. It's working in my app Android. I dont have an IOS to test, so maybe its necessary to test it.

    opened by eduardotq 2
  • incompatible

    incompatible

    Because every version of pattern_formatter depends on intl ^0.15.7 and every version of flutter_localizations from sdk depends on intl 0.16.0, pattern_formatter is incompatible with flutter_localizations from sdk. So, because localize depends on both flutter_localizations any from sdk and pattern_formatter ^0.0.3, version solving failed. pub get failed (1; So, because localize depends on both flutter_localizations any from sdk and pattern_formatter ^0.0.3, version solving failed.)

    opened by guikebr 2
  • Handle non-point decimal separators

    Handle non-point decimal separators

    For some locales, e.g. es_ES, commas are used as the decimal separator. This change allows the ThousandsFormatter to handle that, and any other decimal separator (don't know if there are others apart from comma and point!)

    Fixes #7

    opened by alfredjingle 1
  • ThousandsFormatter, when entering zeros after the fraction, it automatically removes the fraction

    ThousandsFormatter, when entering zeros after the fraction, it automatically removes the fraction

    here my code: inputFormatters: <TextInputFormatter>[ ThousandsFormatter( allowFraction: true, formatter: NumberFormat.decimalPattern("vi_VN")), LengthLimitingTextInputFormatter(15), ],

    opened by ducdac 0
  • Removed Deprecated Functions, Updated Dependency Versions

    Removed Deprecated Functions, Updated Dependency Versions

    Deprecated Components

    • The deprecated function WhitelistingTextInputFormatter have been replaced by FilteringTextInputFormatter.allow
    • The deprecated class WhitelistingTextInputFormatter have been replaced by FilteringTextInputFormatter

    Dependencies

    • Updated the dependency intl to latest version 0.17.0
    • Migrated dependency packages to Null Safety versions
    opened by AldrinMathew 0
  • Null check operator used on a null value exception from date_formatter

    Null check operator used on a null value exception from date_formatter

    An exception is thrown if the date value is set through WidgetTest.

    testWidgets(
          'Test Case: test date validator.',
          (WidgetTester tester) async {
            await app.main();
            await tester.pumpAndSettle();
            
            // Set a date to a text field.
            await tester.enterText(find.byKey(ValueKey<String>('key')), '01/01/2002');
            
            // tap Submit button here
        });
    

    Null check operator used on a null value When the exception was thrown, this was the stack: #0 DateInputFormatter.formatEditUpdate (package:pattern_formatter/date_formatter.dart:82:32) ... ...

    date_formatter.dart:82:32 final splashes = resultText!.replaceAll(RegExp(r'[^/]'), '');

    opened by claptv 0
  • Currency formatter

    Currency formatter

    add currency formatter that supports country codes and currency

    https://user-images.githubusercontent.com/62531088/115955696-bba08200-a52a-11eb-9c93-fb2c3597eac0.mov

    opened by rynssnjn 1
  • Invalid radix-10 number (at character 1) when validating input with this formatter

    Invalid radix-10 number (at character 1) when validating input with this formatter

    Just testing this out.

    Formatting is great, yet when I go to validate and make sure the number is int I get the error message Invalid radix-10 number (at character 1)

    I am calling
    if (int.parse(value) >to validate the value, so it looks like parse is not liking the value

    Here is my validator

                                    validator: (value) {
                                      if (value.isEmpty) {
                                        return 'Please enter an amount.';
                                      }
                                      if (int.parse(value) >
                                              20) {
                                        return 'Please enter a lower amount. The max you can request is '  + 
                                                    20)
                                                .toString();
                                      }
    
                                      return null;
                                    },
    
    opened by giorgio79 2
Owner
HungHD
Full-stack mobile developer (Android, iOS, Flutter).
HungHD
A customised Flutter TextFormField to input international phone number along with country code.

International Phone Field Package A customised Flutter TextFormField to input international phone number along with country code. This widget can be u

Vansh Goel 118 Jan 5, 2023
A Flutter package to parse text and make them into linkified text widget

?? Flutter Parsed text A Flutter package to parse text and extract parts using predefined types like url, phone and email and also supports Regex. Usa

Fayeed Pawaskar 213 Dec 27, 2022
A Flutter Package to render Mathematics, Physics and Chemistry Equations based on LaTeX

flutter_tex Contents About Demo Video Screenshots How to use? Android iOS Web Examples Quick Example TeXView Document TeXView Markdown TeXView Quiz Te

Shahzad Akram 219 Jan 5, 2023
A simple Flutter package that makes turning a FAB into a text field easy.

flutter_text_field_fab A simple Flutter widget that makes turning a FAB into a text field easy.

Haefele Software 4 Jan 18, 2022
Statistics Dart package for easy and efficient data manipulation with many built-in functions and units.

statistics Statistics package for easy and efficient data manipulation with many built-in mathematical functions and units. Usage Numeric extension: i

Graciliano Monteiro Passos 13 Nov 7, 2022
Flutter textfield validation lets you validate different textform fields in your Flutter app

Flutter textfield validation lets you validate different textform fields in your Flutter app

World-Package 2 Sep 15, 2022
A markdown renderer for Flutter.

Flutter Markdown A markdown renderer for Flutter. It supports the original format, but no inline HTML. Overview The flutter_markdown package renders M

Flutter 828 Aug 12, 2021
A masked text for Flutter.

flutter_masked_text Masked text input for flutter. Alert Hi guys! Unfortunately, I'm not developing mobile anymore. This repo will not receive updates

Ben-hur Santos Ott 264 Dec 21, 2022
Soft and gentle rich text editing for Flutter applications.

About Zefyr Soft and gentle rich text editing for Flutter applications. You are viewing early dev preview version of this package which is no longer a

Memspace 2.2k Jan 8, 2023
Flutter widget that automatically resizes text to fit perfectly within its bounds.

Flutter widget that automatically resizes text to fit perfectly within its bounds. Show some ❤️ and star the repo to support the project Resources: Do

Simon Leier 1.8k Jan 3, 2023
flutter 中文排版,支持分页上下对齐 两端对齐 翻页动画

text_composition flutter 中文排版 分页 上下对齐 两端对齐 多栏布局 弃用richText,使用Canvas,精确定位绘图位置,消除字体对排版影响 视频与截图 demo https://github.com/mabDc/text_composition/releases/t

西红柿大芝麻 50 Nov 3, 2022
Flutter Tutorial - PDF Viewer - Asset, File, Network & Firebase

Flutter Tutorial - PDF Viewer - Asset, File, Network & Firebase Use the Flutter PDF Viewer to download PDF documents and display them within your Flut

Johannes Milke 36 Dec 9, 2022
Create an AutoComplete TextField to search JSON data based on suggestions in Flutter.

Flutter Tutorial - AutoComplete TextField & AutoComplete Search Create an AutoComplete TextField to search JSON data based on suggestions in Flutter.

Johannes Milke 32 Oct 23, 2022
A low code editor with the full power of flutter.

flutter_blossom ?? Low code editor with the full power of flutter. Think in flutter, watch your ideas come to life, plan ahead and let your creativity

Flutter Blossom 0 Dec 2, 2021
Soft and gentle rich text editing for Flutter applications

Soft and gentle rich text editing for Flutter applications. Zefyrka is a fork of Zefyr package with the following improvements: support Flutter 2.0 op

null 85 Dec 21, 2022
Rich Text renderer that parses Contentful Rich Text JSON object and returns a renderable Flutter widget

Contentful Rich Text Renderer for Flutter Rich Text renderer that parses Contentful Rich Text field JSON output and produces a Flutter Widget tree tha

Kumanu 45 Nov 10, 2022
Flutter App for beginner

i_am_rich A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if thi

Trần Văn Nguyên 1 Nov 17, 2021
A powerful extended official text for Flutter, which supports Speical Text(Image,@somebody), Custom Background, Custom overFlow, Text Selection.

Extended official text to build special text like inline image or @somebody quickly,it also support custom background,custom over flow and custom selection toolbar and handles.

FlutterCandies 509 Jan 4, 2023
Rich coin project of flutter

rich_coin flutter实现RichCoin项目。 Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

null 0 Nov 27, 2021