Skip to content

Commit b485f10

Browse files
authored
[Gallery] Text field demo fixes (#302)
* Misc text field demo fixes * Update code_segments.dart
1 parent 7a6f443 commit b485f10

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

gallery/gallery/lib/codeviewer/code_segments.dart

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27879,7 +27879,7 @@ class CodeSegments {
2787927879
text: '\u000a prefixText'),
2788027880
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
2788127881
TextSpan(style: codeStyle.baseStyle, text: ' '),
27882-
TextSpan(style: codeStyle.stringStyle, text: '\u0027+1\u0027'),
27882+
TextSpan(style: codeStyle.stringStyle, text: '\u0027+1 \u0027'),
2788327883
TextSpan(style: codeStyle.punctuationStyle, text: ','),
2788427884
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
2788527885
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
@@ -27910,6 +27910,20 @@ class CodeSegments {
2791027910
TextSpan(style: codeStyle.punctuationStyle, text: ';'),
2791127911
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
2791227912
TextSpan(style: codeStyle.punctuationStyle, text: '},'),
27913+
TextSpan(
27914+
style: codeStyle.baseStyle,
27915+
text: '\u000a maxLength'),
27916+
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
27917+
TextSpan(style: codeStyle.baseStyle, text: ' '),
27918+
TextSpan(style: codeStyle.numberStyle, text: '14'),
27919+
TextSpan(style: codeStyle.punctuationStyle, text: ','),
27920+
TextSpan(
27921+
style: codeStyle.baseStyle,
27922+
text: '\u000a maxLengthEnforced'),
27923+
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
27924+
TextSpan(style: codeStyle.baseStyle, text: ' '),
27925+
TextSpan(style: codeStyle.keywordStyle, text: 'false'),
27926+
TextSpan(style: codeStyle.punctuationStyle, text: ','),
2791327927
TextSpan(
2791427928
style: codeStyle.baseStyle,
2791527929
text: '\u000a validator'),
@@ -28189,20 +28203,6 @@ class CodeSegments {
2818928203
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
2819028204
TextSpan(style: codeStyle.baseStyle, text: 'demoTextFieldUSD'),
2819128205
TextSpan(style: codeStyle.punctuationStyle, text: ','),
28192-
TextSpan(
28193-
style: codeStyle.baseStyle,
28194-
text: '\u000a suffixStyle'),
28195-
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
28196-
TextSpan(style: codeStyle.baseStyle, text: ' '),
28197-
TextSpan(style: codeStyle.classStyle, text: 'TextStyle'),
28198-
TextSpan(style: codeStyle.punctuationStyle, text: '('),
28199-
TextSpan(style: codeStyle.baseStyle, text: 'color'),
28200-
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
28201-
TextSpan(style: codeStyle.baseStyle, text: ' '),
28202-
TextSpan(style: codeStyle.classStyle, text: 'Colors'),
28203-
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
28204-
TextSpan(style: codeStyle.baseStyle, text: 'green'),
28205-
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
2820628206
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
2820728207
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
2820828208
TextSpan(

gallery/gallery/lib/demos/material/text_field_demo.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,14 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
209209
.demoTextFieldWhereCanWeReachYou,
210210
labelText: GalleryLocalizations.of(context)
211211
.demoTextFieldPhoneNumber,
212-
prefixText: '+1',
212+
prefixText: '+1 ',
213213
),
214214
keyboardType: TextInputType.phone,
215215
onSaved: (value) {
216216
person.phoneNumber = value;
217217
},
218+
maxLength: 14,
219+
maxLengthEnforced: false,
218220
validator: _validatePhoneNumber,
219221
// TextInputFormatters are applied in sequence.
220222
inputFormatters: <TextInputFormatter>[
@@ -263,7 +265,6 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
263265
GalleryLocalizations.of(context).demoTextFieldSalary,
264266
suffixText:
265267
GalleryLocalizations.of(context).demoTextFieldUSD,
266-
suffixStyle: TextStyle(color: Colors.green),
267268
),
268269
maxLines: 1,
269270
),

0 commit comments

Comments
 (0)