@@ -29,34 +29,87 @@ class _IndexState extends State<Index> {
2929 appBar: AppBar (
3030 title: Text ('TextField' ),
3131 ),
32- body: Center (
33- child: Container (
34- padding: EdgeInsets .all (10.0 ),
35- child: TextField (
36- controller: _textEditingController,
37- maxLength: 20 ,
38- maxLines: 1 ,
39- obscureText: false ,
40- textAlign: TextAlign .center,
41- style: TextStyle (
42- fontSize: 20.0 ,
43- color: Theme .of (context).primaryColor
32+ body: ListView (
33+ children: < Widget > [
34+ Container (
35+ padding: EdgeInsets .all (10.0 ),
36+ child: TextField (
37+ controller: _textEditingController,
38+ maxLength: 20 ,
39+ maxLines: 1 ,
40+ obscureText: false ,
41+ textAlign: TextAlign .start,
42+ style: TextStyle (
43+ fontSize: 20.0 ,
44+ color: Theme .of (context).primaryColor
45+ ),
46+ onChanged: (value) {
47+ print ('正在输入:$value ' );
48+ },
49+ onSubmitted: (value) {
50+ print ('sumbit输入完毕: $value ' );
51+ },
52+ decoration: InputDecoration (
53+ icon: Icon (Icons .subject),
54+ labelText: 'Title' ,
55+ hintText: 'Enter the post title' ,
56+ errorText: 'error' ,
57+ ),
4458 ),
45- onChanged: (value) {
46- print ('正在输入:$value ' );
47- },
48- onSubmitted: (value) {
49- print ('sumbit输入完毕: $value ' );
50- },
51- decoration: InputDecoration (
52- icon: Icon (Icons .subject),
53- // labelText: 'Title',
54- // hintText: 'Enter the post title',
55- // filled: true
59+ ),
60+ Container (
61+ padding: EdgeInsets .all (10.0 ),
62+ child: TextField (
63+ controller: _textEditingController,
64+ maxLength: 20 ,
65+ maxLines: 1 ,
66+ obscureText: false ,
67+ textAlign: TextAlign .start,
68+ style: TextStyle (
69+ fontSize: 20.0 ,
70+ color: Theme .of (context).primaryColor
71+ ),
72+ keyboardType: TextInputType .phone,
73+ decoration: InputDecoration (
74+ labelText: 'Title' ,
75+ hintText: 'Enter the post title' ,
76+ helperText: 'phone' ,
77+ filled: true ,
78+ fillColor: Colors .blue.shade100,
79+ prefixIcon: Icon (Icons .local_airport),
80+ suffixText: 'airport'
81+ ),
5682 ),
5783 ),
58- )
59- ),
84+ Container (
85+ padding: EdgeInsets .all (10.0 ),
86+ child: TextField (
87+ controller: _textEditingController,
88+ maxLength: 20 ,
89+ style: TextStyle (
90+ fontSize: 20.0 ,
91+ color: Theme .of (context).primaryColor
92+ ),
93+ keyboardType: TextInputType .number,
94+ cursorColor: Colors .green,
95+ // cursorRadius: Radius.circular(20),
96+ // cursorWidth: 40,
97+ decoration: InputDecoration (
98+ labelText: 'Title' ,
99+ hintText: 'Enter the post title' ,
100+ helperText: 'number' ,
101+ filled: true ,
102+ fillColor: Colors .blue.shade100,
103+ prefixIcon: Icon (Icons .local_airport),
104+ suffixIcon: Icon (Icons .local_drink),
105+ border: OutlineInputBorder (
106+ borderRadius: BorderRadius .circular (15.0 )
107+ )
108+ ),
109+ ),
110+ )
111+ ],
112+ )
60113 );
61114 }
62115}
0 commit comments