Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
48f2770e
Commit
48f2770e
authored
May 01, 2017
by
Adam Barth
Committed by
GitHub
May 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing docs (#9696)
parent
2ab631b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
46 deletions
+51
-46
text_formatter.dart
packages/flutter/lib/src/services/text_formatter.dart
+51
-46
No files found.
packages/flutter/lib/src/services/text_formatter.dart
View file @
48f2770e
...
...
@@ -8,7 +8,7 @@ import 'package:flutter/services.dart';
/// to provide as-you-type validation and formatting of the text being edited.
///
/// Text modification should only be applied when text is being committed by the
/// IME and not on text under composition (i.e.
when
/// IME and not on text under composition (i.e.
, only when
/// [TextEditingValue.composing] is collapsed).
///
/// Concrete implementations [BlacklistingTextInputFormatter], which removes
...
...
@@ -75,7 +75,8 @@ class _SimpleTextInputFormatter extends TextInputFormatter {
/// characters patterns.
///
/// Instances of blacklisted characters found in the new [TextEditingValue]s
/// will be replaced with the [replacementString] which defaults to ``.
/// will be replaced with the [replacementString] which defaults to the empty
/// string.
///
/// Since this formatter only removes characters from the text, it attempts to
/// preserve the existing [TextEditingValue.selection] to values it would now
...
...
@@ -83,15 +84,16 @@ class _SimpleTextInputFormatter extends TextInputFormatter {
///
/// See also:
///
/// * [
TextInputFormatter].
///
* [WhitelistingTextInputFormatter]
.
/// * [
WhitelistingTextInputFormatter], which uses a whitelist instead of a
///
blacklist
.
class
BlacklistingTextInputFormatter
extends
TextInputFormatter
{
/// Creates a formatter that prevents the insertion of blacklisted characters patterns.
///
/// The [blacklistedPattern] must not be null.
BlacklistingTextInputFormatter
(
this
.
blacklistedPattern
,
{
this
.
blacklistedPattern
,
{
this
.
replacementString
:
''
,
}
)
:
assert
(
blacklistedPattern
!=
null
);
})
:
assert
(
blacklistedPattern
!=
null
);
/// A [Pattern] to match and replace incoming [TextEditingValue]s.
final
Pattern
blacklistedPattern
;
...
...
@@ -126,9 +128,12 @@ class BlacklistingTextInputFormatter extends TextInputFormatter {
///
/// See also:
///
/// * [
TextInputFormatter].
///
* [BlacklistingTextInputFormatter]
.
/// * [
BlacklistingTextInputFormatter], which uses a blacklist instead of a
///
whitelist
.
class
WhitelistingTextInputFormatter
extends
TextInputFormatter
{
/// Creates a formatter that allows only the insertion of whitelisted characters patterns.
///
/// The [blacklistedPattern] must not be null.
WhitelistingTextInputFormatter
(
this
.
whitelistedPattern
)
:
assert
(
whitelistedPattern
!=
null
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment