@@ -7,6 +7,11 @@ class Index extends StatefulWidget {
77
88class _IndexState extends State <Index > {
99 int _currentStep = 0 ;
10+ // final _textEditingController1 = TextEditingController();
11+ // final _textEditingController2 = TextEditingController();
12+ // final _textEditingController3 = TextEditingController();
13+ List <TextEditingController > _textEditingController = [TextEditingController (), TextEditingController (), TextEditingController ()];
14+
1015 @override
1116 void initState () {
1217 super .initState ();
@@ -25,9 +30,11 @@ class _IndexState extends State<Index> {
2530 children: < Widget > [
2631 Theme (
2732 data: Theme .of (context).copyWith (
28- primaryColor: Colors .black
33+ primaryColor: Theme . of (context).primaryColor
2934 ),
3035 child: Stepper (
36+ physics: NeverScrollableScrollPhysics (),
37+ type: StepperType .vertical,
3138 currentStep: _currentStep,
3239 onStepTapped: (int value) {
3340 setState (() {
@@ -46,29 +53,105 @@ class _IndexState extends State<Index> {
4653 },
4754 steps: [
4855 Step (
49- title: Text ('Login' ),
50- subtitle: Text ('Login first' ),
51- content: Text ('Confirm your information' ),
56+ title: Text ('Name' ),
57+ subtitle: Text ('User name' ),
58+ content: Container (
59+ padding: EdgeInsets .all (10.0 ),
60+ child: TextField (
61+ controller: _textEditingController[0 ],
62+ maxLength: 10 ,
63+ style: TextStyle (
64+ fontSize: 20.0 ,
65+ color: Theme .of (context).primaryColor
66+ ),
67+ // autofocus: true,
68+ decoration: InputDecoration (
69+ icon: Icon (Icons .people),
70+ labelText: 'Name' ,
71+ border: OutlineInputBorder (
72+ borderRadius: BorderRadius .circular (15.0 )
73+ )
74+ ),
75+ ),
76+ ),
5277 isActive: _currentStep == 0
5378 ),
5479 Step (
55- title: Text ('Choose plan' ),
56- subtitle: Text ('Choose your plan' ),
57- content: Text ('Confirm your information' ),
80+ title: Text ('Phone' ),
81+ subtitle: Text ('User phone' ),
82+ content: Container (
83+ padding: EdgeInsets .all (10.0 ),
84+ child: TextField (
85+ controller: _textEditingController[1 ],
86+ maxLength: 18 ,
87+ style: TextStyle (
88+ fontSize: 20 ,
89+ color: Theme .of (context).primaryColor
90+ ),
91+ keyboardType: TextInputType .phone,
92+ decoration: InputDecoration (
93+ icon: Icon (Icons .phone),
94+ labelText: 'Phone' ,
95+ border: OutlineInputBorder (
96+ borderRadius: BorderRadius .circular (15.0 )
97+ )
98+ ),
99+ ),
100+ ),
58101 isActive: _currentStep == 1
59102 ),
60103 Step (
61- title: Text ('Confirm payment' ),
62- subtitle: Text ('Confirm yoir payment method' ),
63- content: Text ('Confirm your information' ),
104+ title: Text ('Email' ),
105+ subtitle: Text ('User email' ),
106+ content: Container (
107+ padding: EdgeInsets .all (10.0 ),
108+ child: TextField (
109+ controller: _textEditingController[2 ],
110+ maxLength: 20 ,
111+ style: TextStyle (
112+ fontSize: 20 ,
113+ color: Theme .of (context).primaryColor
114+ ),
115+ keyboardType: TextInputType .emailAddress,
116+ decoration: InputDecoration (
117+ icon: Icon (Icons .email),
118+ labelText: 'Email' ,
119+ border: OutlineInputBorder (
120+ borderRadius: BorderRadius .circular (15.0 )
121+ )
122+ ),
123+ ),
124+ ),
64125 isActive: _currentStep == 2
65126 ),
66127 ],
67128 ),
129+ ),
130+ RaisedButton (
131+ color: Theme .of (context).primaryColor,
132+ onPressed: _openSimpleDialog,
133+ child: Text ('Click on me to show information' ,style: TextStyle (color: Colors .white),),
68134 )
69135 ],
70136 ),
71137 )
72138 );
73139 }
140+
141+ Future _openSimpleDialog () async {
142+ showDialog (
143+ context: context,
144+ builder: (BuildContext context) {
145+ return SimpleDialog (
146+ title: Text ('User Information' ),
147+ titlePadding: EdgeInsets .fromLTRB (24.0 , 24.0 , 24.0 , 0 ),
148+ contentPadding: EdgeInsets .fromLTRB (24.0 , 12.0 , 0.0 , 16.0 ),
149+ children: List .generate (3 , (index) {
150+ return Text ('${_textEditingController [index ].text }' );
151+ }),
152+ );
153+ }
154+ );
155+ }
156+
74157}
0 commit comments