File tree 1 file changed +31
-1
lines changed 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,42 @@ class HomePage extends StatefulWidget{
22
22
}
23
23
24
24
class _MyAppState extends State <HomePage >{
25
+
26
+ String myText = "Hello World" ;
27
+ void _changeText (){
28
+ setState (() {
29
+ if (myText.startsWith ("H" )){
30
+ myText = "Welcome to app" ;
31
+ }else {
32
+ myText = "Hello World" ;
33
+ }
34
+ });
35
+ }
36
+
37
+ Widget _bodyWidget (){
38
+ return new Container (
39
+ padding: const EdgeInsets .all (8.0 ),
40
+ child: new Center (
41
+ child: new Column (
42
+ mainAxisAlignment: MainAxisAlignment .center,
43
+ children: < Widget > [
44
+ new Text (myText, style: new TextStyle (fontSize: 20.0 ),),
45
+ new RaisedButton (child: new Text ("Click" ,style: new TextStyle (color: Colors .white),),
46
+ onPressed: _changeText,
47
+ color: Colors .blue,
48
+ )
49
+ ],),
50
+ ),
51
+ );
52
+
53
+ }
54
+
25
55
@override
26
56
Widget build (BuildContext context) {
27
57
return new Scaffold (
28
58
appBar: new AppBar (title: new Text ("Home Page" ),
29
59
),
30
- body: new Center (child : new Text ( "Hello World" ),),
60
+ body: _bodyWidget ()
31
61
);
32
62
}
33
63
You can’t perform that action at this time.
0 commit comments