[Gallery] Text field demo fixes (#302)

* Misc text field demo fixes

* Update code_segments.dart
pull/305/head
Pierre-Louis 5 years ago committed by GitHub
parent 7a6f443b88
commit b485f10fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27879,7 +27879,7 @@ class CodeSegments {
text: '\u000a prefixText'), text: '\u000a prefixText'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.stringStyle, text: '\u0027+1\u0027'), TextSpan(style: codeStyle.stringStyle, text: '\u0027+1 \u0027'),
TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.punctuationStyle, text: '),'),
@ -27910,6 +27910,20 @@ class CodeSegments {
TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.punctuationStyle, text: ';'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '},'), TextSpan(style: codeStyle.punctuationStyle, text: '},'),
TextSpan(
style: codeStyle.baseStyle,
text: '\u000a maxLength'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.numberStyle, text: '14'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(
style: codeStyle.baseStyle,
text: '\u000a maxLengthEnforced'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'false'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan( TextSpan(
style: codeStyle.baseStyle, style: codeStyle.baseStyle,
text: '\u000a validator'), text: '\u000a validator'),
@ -28189,20 +28203,6 @@ class CodeSegments {
TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.punctuationStyle, text: ').'),
TextSpan(style: codeStyle.baseStyle, text: 'demoTextFieldUSD'), TextSpan(style: codeStyle.baseStyle, text: 'demoTextFieldUSD'),
TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(
style: codeStyle.baseStyle,
text: '\u000a suffixStyle'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'TextStyle'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: 'color'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'Colors'),
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
TextSpan(style: codeStyle.baseStyle, text: 'green'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan( TextSpan(

@ -209,12 +209,14 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
.demoTextFieldWhereCanWeReachYou, .demoTextFieldWhereCanWeReachYou,
labelText: GalleryLocalizations.of(context) labelText: GalleryLocalizations.of(context)
.demoTextFieldPhoneNumber, .demoTextFieldPhoneNumber,
prefixText: '+1', prefixText: '+1 ',
), ),
keyboardType: TextInputType.phone, keyboardType: TextInputType.phone,
onSaved: (value) { onSaved: (value) {
person.phoneNumber = value; person.phoneNumber = value;
}, },
maxLength: 14,
maxLengthEnforced: false,
validator: _validatePhoneNumber, validator: _validatePhoneNumber,
// TextInputFormatters are applied in sequence. // TextInputFormatters are applied in sequence.
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
@ -263,7 +265,6 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
GalleryLocalizations.of(context).demoTextFieldSalary, GalleryLocalizations.of(context).demoTextFieldSalary,
suffixText: suffixText:
GalleryLocalizations.of(context).demoTextFieldUSD, GalleryLocalizations.of(context).demoTextFieldUSD,
suffixStyle: TextStyle(color: Colors.green),
), ),
maxLines: 1, maxLines: 1,
), ),

Loading…
Cancel
Save