File tree 3 files changed +34
-0
lines changed 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -18,3 +18,4 @@ Mike Hoolehan <mike@hoolehan.com>
18
18
German Saprykin <saprykin.h@gmail.com>
19
19
Stefano Rodriguez <hlsroddy@gmail.com>
20
20
Yusuke Konishi <yahpeycoy0403@gmail.com>
21
+ Fredrik Simón <fredrik@fsimon.net>
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ class TextFormField extends FormField<String> {
48
48
InputDecoration decoration: const InputDecoration (),
49
49
TextInputType keyboardType: TextInputType .text,
50
50
TextStyle style,
51
+ TextAlign textAlign: TextAlign .start,
51
52
bool autofocus: false ,
52
53
bool obscureText: false ,
53
54
bool autocorrect: true ,
@@ -57,6 +58,7 @@ class TextFormField extends FormField<String> {
57
58
List <TextInputFormatter > inputFormatters,
58
59
}) : assert (initialValue != null ),
59
60
assert (keyboardType != null ),
61
+ assert (textAlign != null ),
60
62
assert (autofocus != null ),
61
63
assert (obscureText != null ),
62
64
assert (autocorrect != null ),
@@ -74,6 +76,7 @@ class TextFormField extends FormField<String> {
74
76
decoration: decoration.copyWith (errorText: field.errorText),
75
77
keyboardType: keyboardType,
76
78
style: style,
79
+ textAlign: textAlign,
77
80
autofocus: autofocus,
78
81
obscureText: obscureText,
79
82
autocorrect: autocorrect,
Original file line number Diff line number Diff line change
1
+ // Copyright 2017 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import 'package:flutter/material.dart' ;
6
+ import 'package:flutter_test/flutter_test.dart' ;
7
+
8
+ void main () {
9
+ testWidgets ('Passes textAlign to underlying TextField' , (WidgetTester tester) async {
10
+ const TextAlign alignment = TextAlign .center;
11
+
12
+ await tester.pumpWidget (
13
+ new MaterialApp (
14
+ home: new Material (
15
+ child: new Center (
16
+ child: new TextFormField (
17
+ textAlign: alignment,
18
+ ),
19
+ ),
20
+ ),
21
+ ),
22
+ );
23
+
24
+ final Finder textFieldFinder = find.byType (TextField );
25
+ expect (textFieldFinder, findsOneWidget);
26
+
27
+ final TextField textFieldWidget = tester.widget (textFieldFinder);
28
+ expect (textFieldWidget.textAlign, alignment);
29
+ });
30
+ }
You can’t perform that action at this time.
0 commit comments