@@ -46,17 +46,17 @@ class MyApp extends StatelessWidget {
4646}
4747
4848class MyHomePage extends StatefulWidget {
49- MyHomePage ({Key key, this .title}) : super (key: key);
49+ MyHomePage ({Key ? key, this .title}) : super (key: key);
5050
51- final String title;
51+ final String ? title;
5252
5353 @override
5454 _MyHomePageState createState () => _MyHomePageState ();
5555}
5656
5757class _MyHomePageState extends State <MyHomePage > {
58- Timer _timer;
59- double _progress;
58+ Timer ? _timer;
59+ late double _progress;
6060
6161 @override
6262 void initState () {
@@ -75,7 +75,7 @@ class _MyHomePageState extends State<MyHomePage> {
7575 Widget build (BuildContext context) {
7676 return Scaffold (
7777 appBar: AppBar (
78- title: Text (widget.title),
78+ title: Text (widget.title ?? '' ),
7979 ),
8080 body: Container (
8181 width: MediaQuery .of (context).size.width,
@@ -89,8 +89,7 @@ class _MyHomePageState extends State<MyHomePage> {
8989 runAlignment: WrapAlignment .center,
9090 crossAxisAlignment: WrapCrossAlignment .center,
9191 children: < Widget > [
92- FlatButton (
93- textColor: Colors .blue,
92+ TextButton (
9493 child: Text ('open test page' ),
9594 onPressed: () {
9695 _timer? .cancel ();
@@ -102,17 +101,15 @@ class _MyHomePageState extends State<MyHomePage> {
102101 );
103102 },
104103 ),
105- FlatButton (
106- textColor: Colors .blue,
104+ TextButton (
107105 child: Text ('dismiss' ),
108106 onPressed: () async {
109107 _timer? .cancel ();
110108 await EasyLoading .dismiss ();
111109 print ('EasyLoading dismiss' );
112110 },
113111 ),
114- FlatButton (
115- textColor: Colors .blue,
112+ TextButton (
116113 child: Text ('show' ),
117114 onPressed: () async {
118115 _timer? .cancel ();
@@ -123,8 +120,7 @@ class _MyHomePageState extends State<MyHomePage> {
123120 print ('EasyLoading show' );
124121 },
125122 ),
126- FlatButton (
127- textColor: Colors .blue,
123+ TextButton (
128124 child: Text ('showToast' ),
129125 onPressed: () {
130126 _timer? .cancel ();
@@ -133,33 +129,29 @@ class _MyHomePageState extends State<MyHomePage> {
133129 );
134130 },
135131 ),
136- FlatButton (
137- textColor: Colors .blue,
132+ TextButton (
138133 child: Text ('showSuccess' ),
139134 onPressed: () async {
140135 _timer? .cancel ();
141136 await EasyLoading .showSuccess ('Great Success!' );
142137 print ('EasyLoading showSuccess' );
143138 },
144139 ),
145- FlatButton (
146- textColor: Colors .blue,
140+ TextButton (
147141 child: Text ('showError' ),
148142 onPressed: () {
149143 _timer? .cancel ();
150144 EasyLoading .showError ('Failed with Error' );
151145 },
152146 ),
153- FlatButton (
154- textColor: Colors .blue,
147+ TextButton (
155148 child: Text ('showInfo' ),
156149 onPressed: () {
157150 _timer? .cancel ();
158151 EasyLoading .showInfo ('Useful Information.' );
159152 },
160153 ),
161- FlatButton (
162- textColor: Colors .blue,
154+ TextButton (
163155 child: Text ('showProgress' ),
164156 onPressed: () {
165157 _progress = 0 ;
0 commit comments