v0.0.3mask_input_formatter
用于 TextField 和 TextFormField 的 TextInputFormatter,可根据给定的掩码格式化输入。
amjadjamali06/mask_input_formatter open-source repository details.
以下为英文项目原文快照,最新内容请访问 GitHub。
The package provides TextInputFormatter for TextField and TextFormField which format the input by a given mask.
Run this command:
With Flutter:
$ flutter pub add mask_input_formatter
or add following package in your pubspec.yaml file inside the dependencies: section.
dependencies:
mask_input_formatter: ^0.0.3
import 'package:mask_input_formatter/mask_input_formatter.dart';
MaskInputFormatter myFormatter = MaskInputFormatter(mask: '(AA) #####');
TextFormField(
inputFormatters: [myFormatter],
decoration: InputDecoration(
hintText: "(AB) 12345",
)
) // TextFormField
// Input --> JK75757
// Output --> (JK) 75757 set formatted text on TextField
You can use the mask whatever you defined in formatter:
MaskInputFormatter dateFormatter = MaskInputFormatter(mask: '##/##/####');
// --> 26/05/2021
MaskInputFormatter phoneFormatter = MaskInputFormatter(mask: '+# (###) ###-####');
// --> +1 (234) 567-8901
MaskInputFormatter numberFormatter = MaskInputFormatter(mask: 'AAA-###', textAllCaps: true);
// --> XYZ-789
Check example folder for code sample
In last example. --> (AAA-###)
Suggestions and Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Amjad Jamali & team members ( Kamran Khan, Hina Hussain, Faiza Farooqui ) :tada:
依赖清单 2 项
{"sdk":"flutter"}{"sdk":"flutter"}先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗